Hi, I need to manually add in-content ad placeholders to my single posts (for CLS-related reasons). My intention is to take advantage of Ad Inserter for an automatic insertion after every X paragraphs, so that it works regardless of the article’s length.
The problem is that the code of each placeholder slightly differs by a progressive number, so it’s not always the exact same code to repeat. (E.g. <div id=”ad-1″> and <div id=”ad-2″>). Is there a way I could achieve what I’m trying to do through your plugin?
Thank you in advance for your response.
This topic was modified 2 years, 1 month ago by simsworldit.
This topic was modified 2 years, 1 month ago by simsworldit.
To insert every N paragraphs use %N as paragraph number (means insertion every N paragraphs) or %N@S (means insertion every N paragraphs starting from paragraph S): https://adinserter.pro/documentation/paragraph-settings
If you would like to insert different HTML element ID for each insertion then there are two possible approaches.
use shortcode for block counter [ADINSERTER counter="block-number"] for example for block N you would insert <div id="ad-[ADINSERTER counter='N']"> .
Hi, thank you for answering. From my understanding, the options you indicated work only when the number of ads to insert is pre-determined. In my case, however, they vary depending on the post’s length. So for example, in a brief newsarticle there might be 2-3 in-content ads, whereas a long post could contain more than 15 of them, with the last sample code being <div id="ad-15">.
I tried using <div id="ad-[ADINSERTER counter='N']"> thinking “N” would function as a variable, but I figured it’s not meant to be a number that automatically progresses, which is what would fulfill my goal. Besides, I’m surely missing something but I can’t get the [ADINSERTER counter="..."] shortcode to work in general. I even did a test including an actual number but it always comes out as <div id="ad-">. I made sure to tick “Shortcodes” from the options.
Ok, let me know what I did wrong. Unfortunately I couldn’t find anything related to the use of the [ADINSERTER counter=”N”] in the documentation, this is why it’s still not clear to me how to set it properly. I apologize.
I included the following code in the block, I set it to be inserted after every 3 parapraphs, starting from parapgraph 1. I expect to see <div id="eadv-in-content-1">, <div id="eadv-in-content-2">, <div id="eadv-in-content-3">… and so on being placed automatically until the end of the post. Through Inspect mode though I see all the codes appear as <div id="eadv-in-content-">.
In your case please use the following code and use single quotes inside id with double quotes: <div id="eadv-in-content-[ADINSERTER counter='block']" class="eadv-in-content"></div>
Great. Very likely the first insertion is not visible, the theme calls the content for some other purpose and discards output.
BTW the counter shortcode format I posted in the first reply is a deprecated one. This is the right format for block insertion counter: [ADINSERTER counter='block']
Thank you again. One last thing: I tried excluding from the count all paragraphs using “wp-caption-text” as CSS class, in order to prevent results like the one in the picture from happening too frequently (that is, the block appearing in between the image and its caption text).
Such rule seems to be ignored by the plugin though, as the placeholder keeps appearing right under the caption text in a article structured as follows:
[Paragraph 1]
[Paragraph 2]
[Image with caption paragraph]
[Paragraph 3]
In this case it’s supposed to appear under paragraph 3, not the caption. You can also check it on this example page.
Here’s how I set it up. I also tried typing .wp-caption-text alternatively, but it won’t work either.
This reply was modified 2 years, 1 month ago by simsworldit.
Viewing 10 replies - 1 through 10 (of 10 total)
The topic ‘Automatic in-content ads insertion’ is closed to new replies.