Last active
December 19, 2015 01:48
-
-
Save adapicom/5878191 to your computer and use it in GitHub Desktop.
Ad Inside Wordpress Content
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$paragraphAfter= 7; //display after the first paragraph | |
$content = apply_filters('the_content', get_the_content()); | |
$content = explode("</p>", $content); | |
for ($i = 0; $i <count($content); $i++ ) { | |
if ($i == $paragraphAfter) { ?> | |
<!-- Place Ad Content Here --> | |
<?php } | |
echo $content[$i] . "</p>"; | |
} ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment