Support » How-To and Troubleshooting » Insert ad or image after first paragraph
4 years, 10 months ago
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.
$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)
if($p_count == $show_after_p)