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 came about because I was trying to split a title string at the dash within WordPress. Not-so-quickly realizing that I had to account for all...
The outcome of this snippet will be an image with the size “square” (assuming you have this in your functions.php) followed by the nav item title....
This code snippet example uses WP_Query to group event posts by month and adds a pagination that queries the previous and next month’s event results. The...