Basically, I want to add a function that executes half way through the_content();
I want to add a message/ad block whatever in the middle of all of my content without having to go in to each individual page and add the block.
Is this even possible?
Basically, I want to add a function that executes half way through the_content();
I want to add a message/ad block whatever in the middle of all of my content without having to go in to each individual page and add the block.
Is this even possible?
You must be logged in to post a comment.
Use this function
ad_content()
in replace ofthe_content()
in your template.Of course it’s possible, you’ll just want to write a function that finds the middle of the content then ads your block. Something like this
This is totally untested and may need to be reworked I got the code to find the middle from here.
Edit: As OneTrickPoney pointed out we need to check for HTML tags one method may be to use php’s strip_tags() function . and add something like this after the first content call:
the problem will be adding the tags back at the end.