need to retain nextpage paginating tag in custom query
-
I need to use $post->post_content to get the raw post so that i can use the EXPLODE php command. But when i do use $post->post_content, it filters out the tags that are in my post which need to be retained. here is my script. what am i doing wrong? i’m just trying to inject an Ad after paragraphs that contain an image in single.php. thanks!
<?php $content = apply_filters('the_content', $post->post_content); $contents = array_filter(explode("</p>", $content)); foreach ($contents as $content) { if (strpos($content, '<img') !== false ) { echo $content; echo "</p>after image ad"; } else { echo $content; echo "</p>"; } } ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘need to retain nextpage paginating tag in custom query’ is closed to new replies.