<?xml version="1.0" encoding="UTF-8"?>        <rss version="2.0"
             xmlns:atom="http://www.w3.org/2005/Atom"
             xmlns:dc="http://purl.org/dc/elements/1.1/"
             xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
             xmlns:admin="http://webns.net/mvcb/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:content="http://purl.org/rss/1.0/modules/content/">
        <channel>
            <title>
									Coding to inject an AD after the 1st paragraph works only on the 1st page. How could I extend it to all sub-pages? - Advanced Content Pagination				            </title>
            <link>https://gvectors.com/forum/advanced-content-pagination/resolved-coding-to-inject-an-ad-after-the-1st-paragraph-works-only-on-the-1st-page-how-could-i-extend-it-to-all-sub-pages/</link>
            <description>WordPress Plugins Support Forum</description>
            <language>en-US</language>
            <lastBuildDate>Thu, 21 May 2026 16:52:38 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>Ok, thank you for the good idea, I think it&#039;s possible to add subPage content managing options in this plugin. However the only valuable option I see now is the &#034;Show Featured Image - yes/no&#034;. Have you other suggestion for this?Regarding to a co...</title>
                        <link>https://gvectors.com/forum/advanced-content-pagination/resolved-coding-to-inject-an-ad-after-the-1st-paragraph-works-only-on-the-1st-page-how-could-i-extend-it-to-all-sub-pages/#post-98</link>
                        <pubDate>Tue, 02 Sep 2014 11:40:03 +0000</pubDate>
                        <description><![CDATA[Ok, thank you for the good idea, I think it&#039;s possible to add subPage content managing options in this plugin. However the only valuable option I see now is the &quot;Show Featured Image - yes/no...]]></description>
                        <content:encoded><![CDATA[Ok, thank you for the good idea, I think it's possible to add subPage content managing options in this plugin. However the only valuable option I see now is the "Show Featured Image - yes/no". Have you other suggestion for this?
	
	Regarding to a code injection into ACP subPages, please try this, maybe the $content returns the whole content:
	<pre>function prefix_insert_after_paragraph( $insertion, $paragraph_id, $content ) {
	    $subPages = explode('[nextpage', $content);
	    if( !empty($subPages) ){
	        $new_content = '';
	        foreach( $subPages as $subPage ){
	            $closing_p = '&lt;/p&gt;';
	            $paragraphs = explode( $closing_p, $subPage );
	            foreach ($paragraphs as $index =&gt; $paragraph) {
	                if ( trim( $paragraph ) ) {
	                    $paragraphs .= $closing_p;
	                }
	                if ( $paragraph_id == $index + 1 ) {
	                    $paragraphs .= $insertion;
	                }
	            }
	            $new_content[] = implode( '', $paragraphs );
	        }
	        return implode( '[nextpage', $new_content);
	    }
	    else{
	        return $content;
	    }
	}</pre>
	I'd also recommend set high priority for your function:
	<pre>add_filter( 'the_content', 'prefix_insert_post_ads', <span style="color: #ff0000;"><strong>1</strong></span> );</pre>]]></content:encoded>
						                            <category domain="https://gvectors.com/forum/advanced-content-pagination/">Advanced Content Pagination</category>                        <dc:creator>Tom</dc:creator>
                        <guid isPermaLink="true">https://gvectors.com/forum/advanced-content-pagination/resolved-coding-to-inject-an-ad-after-the-1st-paragraph-works-only-on-the-1st-page-how-could-i-extend-it-to-all-sub-pages/#post-98</guid>
                    </item>
				                    <item>
                        <title>So what I could think about is something like this logic:1) If this is a page using NEXTPAGE (so using your pluin);2) If this page is the &#039;first&#039; page, then display this:&lt;div class=&#034;entry-featured&#034;&gt; &lt;?php x_featured_image(); ?&amp;...</title>
                        <link>https://gvectors.com/forum/advanced-content-pagination/resolved-coding-to-inject-an-ad-after-the-1st-paragraph-works-only-on-the-1st-page-how-could-i-extend-it-to-all-sub-pages/#post-97</link>
                        <pubDate>Tue, 02 Sep 2014 11:14:47 +0000</pubDate>
                        <description><![CDATA[So what I could think about is something like this logic:
	
	1) If this is a page using NEXTPAGE (so using your pluin);
	
	2) If this page is the &#039;first&#039; page, then display this:
	&lt;d...]]></description>
                        <content:encoded><![CDATA[So what I could think about is something like this logic:
	
	1) If this is a page using NEXTPAGE (so using your pluin);
	
	2) If this page is the 'first' page, then display this:
	<pre>&lt;div class="entry-featured"&gt;
	 &lt;?php x_featured_image(); ?&gt;
	 &lt;/div&gt;</pre>
	Thanks,
	Mihai]]></content:encoded>
						                            <category domain="https://gvectors.com/forum/advanced-content-pagination/">Advanced Content Pagination</category>                        <dc:creator>info1</dc:creator>
                        <guid isPermaLink="true">https://gvectors.com/forum/advanced-content-pagination/resolved-coding-to-inject-an-ad-after-the-1st-paragraph-works-only-on-the-1st-page-how-could-i-extend-it-to-all-sub-pages/#post-97</guid>
                    </item>
				                    <item>
                        <title>Hi Tom,Apart from the above, I would like to ask you about something else, maybe a new feature for this plugin.At the top of my articles I&#039;m using this coding:&lt;div class=&#034;entry-featured&#034;&gt; &lt;?php x_featured_image(); ?&gt;&lt;/di...</title>
                        <link>https://gvectors.com/forum/advanced-content-pagination/resolved-coding-to-inject-an-ad-after-the-1st-paragraph-works-only-on-the-1st-page-how-could-i-extend-it-to-all-sub-pages/#post-95</link>
                        <pubDate>Tue, 02 Sep 2014 11:14:03 +0000</pubDate>
                        <description><![CDATA[Hi Tom,
	
	Apart from the above, I would like to ask you about something else, maybe a new feature for this plugin.
	
	At the top of my articles I&#039;m using this coding:
	&lt;div class=&quot;e...]]></description>
                        <content:encoded><![CDATA[Hi Tom,
	
	Apart from the above, I would like to ask you about something else, maybe a new feature for this plugin.
	
	At the top of my articles I'm using this coding:
	<pre>&lt;div class="entry-featured"&gt;
	 &lt;?php x_featured_image(); ?&gt;
	&lt;/div&gt;</pre>
	This is displaying the featured image, which is an image as wide as the layout.
	
	I would like the ability to display that image only on the 1st page.
	
	At the moment this shows up across all pages, so also on the /2, /3, /4 etc. sub-pages.
	
	When you build this capability it would be nice to be able to add custom stuff based on the page number.
	
	So for this request of mine I would use page 1, but maybe some other people would like to display something on other pages.
	
	A good idea could be to let people specify the page number or things like: 'first' or 'last'.
	
	In other words somebody may want to add a text on the very last sub-page, say a link to a specific page or section.
	
	Thanks,
	Mihai]]></content:encoded>
						                            <category domain="https://gvectors.com/forum/advanced-content-pagination/">Advanced Content Pagination</category>                        <dc:creator>info1</dc:creator>
                        <guid isPermaLink="true">https://gvectors.com/forum/advanced-content-pagination/resolved-coding-to-inject-an-ad-after-the-1st-paragraph-works-only-on-the-1st-page-how-could-i-extend-it-to-all-sub-pages/#post-95</guid>
                    </item>
				                    <item>
                        <title>Coding to inject an AD after the 1st paragraph works only on the 1st page. How could I extend it to all sub-pages?</title>
                        <link>https://gvectors.com/forum/advanced-content-pagination/resolved-coding-to-inject-an-ad-after-the-1st-paragraph-works-only-on-the-1st-page-how-could-i-extend-it-to-all-sub-pages/#post-92</link>
                        <pubDate>Tue, 02 Sep 2014 11:12:44 +0000</pubDate>
                        <description><![CDATA[Dear Support,
	
	I just started to use your ACP plugin.
	
	It works very well, but I noticed a problem.
	
	With this coding inside &#039;functions.php&#039;:
	//Insert ads after second paragrap...]]></description>
                        <content:encoded><![CDATA[Dear Support,
	
	I just started to use your ACP plugin.
	
	It works very well, but I noticed a problem.
	
	With this coding inside 'functions.php':
	<pre>//Insert ads after second paragraph of single post content.
	add_filter( 'the_content', 'prefix_insert_post_ads' );
	
	function prefix_insert_post_ads( $content ) {
	    $ad_code = '&lt;!-- 300x250 --&gt;';
	    if ( is_single() && ! is_admin() ) {
	        return prefix_insert_after_paragraph( $ad_code, 2, $content );
	    }
	    return $content;
	}
	
	// Parent Function that makes the magic happen
	function prefix_insert_after_paragraph( $insertion, $paragraph_id, $content ) {
	    $closing_p = '&lt;/p&gt;';
	    $paragraphs = explode( $closing_p, $content );
	    foreach ($paragraphs as $index =&gt; $paragraph) {
	        if ( trim( $paragraph ) ) {
	            $paragraphs .= $closing_p;
	        }
	        if ( $paragraph_id == $index + 1 ) {
	            $paragraphs .= $insertion;
	        }
	    }
	    return implode( '', $paragraphs );
	}</pre>
	
	
	I'm injecting an ad after the 1st text paragraph of my articles.
	
	After enabling your plugin and adding the necessary shortcodes, I see that this AD shows up only on the 1st page.
	
	Is there anything we could do to have the AD show up also inside all the sub-pages?
	
	Thanks,
	Mihai]]></content:encoded>
						                            <category domain="https://gvectors.com/forum/advanced-content-pagination/">Advanced Content Pagination</category>                        <dc:creator>info1</dc:creator>
                        <guid isPermaLink="true">https://gvectors.com/forum/advanced-content-pagination/resolved-coding-to-inject-an-ad-after-the-1st-paragraph-works-only-on-the-1st-page-how-could-i-extend-it-to-all-sub-pages/#post-92</guid>
                    </item>
				                    <item>
                        <title>Let me add that this last feature request that I just mentioned is for the rest of the page, more specifically the top of the page even above the main title (h1), not the &#039;acp_wrapper&#039; loop.</title>
                        <link>https://gvectors.com/forum/advanced-content-pagination/resolved-coding-to-inject-an-ad-after-the-1st-paragraph-works-only-on-the-1st-page-how-could-i-extend-it-to-all-sub-pages/#post-96</link>
                        <pubDate>Mon, 01 Sep 2014 20:16:54 +0000</pubDate>
                        <description><![CDATA[Let me add that this last feature request that I just mentioned is for the rest of the page, more specifically the top of the page even above the main title (h1), not the &#039;acp_wrapper&#039; loop.]]></description>
                        <content:encoded><![CDATA[Let me add that this last feature request that I just mentioned is for the rest of the page, more specifically the top of the page even above the main title (h1), not the 'acp_wrapper' loop.]]></content:encoded>
						                            <category domain="https://gvectors.com/forum/advanced-content-pagination/">Advanced Content Pagination</category>                        <dc:creator>info1</dc:creator>
                        <guid isPermaLink="true">https://gvectors.com/forum/advanced-content-pagination/resolved-coding-to-inject-an-ad-after-the-1st-paragraph-works-only-on-the-1st-page-how-could-i-extend-it-to-all-sub-pages/#post-96</guid>
                    </item>
				                    <item>
                        <title>Hi Tom,Thanks for your feedback!What I am using is not the &#034;Ajax&#034; loading type, but the &#034;Reload Page&#034; one because my goal is to generate more page views.Any idea what coding should I do instead of the above?Or maybe there is somethi...</title>
                        <link>https://gvectors.com/forum/advanced-content-pagination/resolved-coding-to-inject-an-ad-after-the-1st-paragraph-works-only-on-the-1st-page-how-could-i-extend-it-to-all-sub-pages/#post-94</link>
                        <pubDate>Mon, 01 Sep 2014 14:31:24 +0000</pubDate>
                        <description><![CDATA[Hi Tom,
	
	Thanks for your feedback!
	
	What I am using is not the &quot;Ajax&quot; loading type, but the &quot;Reload Page&quot; one because my goal is to generate more page views.
	
	Any idea what codin...]]></description>
                        <content:encoded><![CDATA[Hi Tom,
	
	Thanks for your feedback!
	
	What I am using is not the "Ajax" loading type, but the "Reload Page" one because my goal is to generate more page views.
	
	Any idea what coding should I do instead of the above?
	
	Or maybe there is something you may like to add to the plugin to make this possible.
	
	Kind Regards,
	
	Mihai]]></content:encoded>
						                            <category domain="https://gvectors.com/forum/advanced-content-pagination/">Advanced Content Pagination</category>                        <dc:creator>info1</dc:creator>
                        <guid isPermaLink="true">https://gvectors.com/forum/advanced-content-pagination/resolved-coding-to-inject-an-ad-after-the-1st-paragraph-works-only-on-the-1st-page-how-could-i-extend-it-to-all-sub-pages/#post-94</guid>
                    </item>
				                    <item>
                        <title>Hi Mihai,It seems you use pagination Ajax loading type. This type doesn&#039;t allow you to do this injection. It can be possible if you change the loading type to simple/refresh. You can do that in Dashboard &gt; AP Pagination, just set &#034;Pagination loadin...</title>
                        <link>https://gvectors.com/forum/advanced-content-pagination/resolved-coding-to-inject-an-ad-after-the-1st-paragraph-works-only-on-the-1st-page-how-could-i-extend-it-to-all-sub-pages/#post-93</link>
                        <pubDate>Mon, 01 Sep 2014 11:28:45 +0000</pubDate>
                        <description><![CDATA[Hi Mihai,
	It seems you use pagination Ajax loading type. This type doesn&#039;t allow you to do this injection. It can be possible if you change the loading type to simple/refresh. You can do t...]]></description>
                        <content:encoded><![CDATA[Hi Mihai,
	It seems you use pagination Ajax loading type. This type doesn't allow you to do this injection. It can be possible if you change the loading type to simple/refresh. You can do that in Dashboard > AP Pagination, just set "Pagination loading type" as "Reload Page".
	
	Please try with this option and let us know if it works.]]></content:encoded>
						                            <category domain="https://gvectors.com/forum/advanced-content-pagination/">Advanced Content Pagination</category>                        <dc:creator>Tom</dc:creator>
                        <guid isPermaLink="true">https://gvectors.com/forum/advanced-content-pagination/resolved-coding-to-inject-an-ad-after-the-1st-paragraph-works-only-on-the-1st-page-how-could-i-extend-it-to-all-sub-pages/#post-93</guid>
                    </item>
							        </channel>
        </rss>
		