Last active
March 21, 2017 12:11
-
-
Save theukedge/6745757 to your computer and use it in GitHub Desktop.
This file contains 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 | |
$show_after_p = 2; | |
$content = apply_filters('the_content', $post->post_content); | |
if(substr_count($content, '<p>') > $show_after_p) | |
{ | |
$contents = explode("</p>", $content); | |
$p_count = 1; | |
foreach($contents as $content) | |
{ | |
echo $content; | |
if($p_count == $show_after_p) | |
{ | |
?> | |
YOUR AD CODE GOES HERE | |
<?php | |
} | |
echo "</p>"; | |
$p_count++; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi, This code is nice but
Some pages do not show content but only visible visual. How to fix this code