Modify post content to insert text after h2
This code snippet filters the_content(), uses regex to find the first h2 and insert content from an ACF custom field named affiliate_text from the options page.
This code snippet filters the_content(), uses regex to find the first h2 and insert content from an ACF custom field named affiliate_text from the options page.
This is for instances where you want to extract a block out of a typical layout (say a hero when the following content is laid out...
When getting data using the REST API from a separate site, this is a great snippet to add the data for post featured images as well...
To add functionality that allows you to add an HTML (ID) anchor to a section, add the following supports when you register your custom ACF block:...