I’m using the below code to insert ads/images after 1 paragraph. It functions properly, however, the ‘Next Page’ functionality stops working.
Is it somehow possible to add ‘wp_link_pages’ somewhere within?
Any guidance would be appreciated, thank you.
<?php
$show_after_p = 1;
$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)
{
?>
AD CODE
<?
}
echo "</p>";
$p_count++;
}
}
?>