• Resolved simsworldit

    (@simsworldit)


    Hi, I’m back with another issue. I included the following code on posts and pages to automatically insert ads every three paragraphs starting paragraph 4 (there’s a separate block for the very first placeholder):

    <div id="eadv-in-content-[ADINSERTER counter='block']" class="eadv-in-content">

    For some unknown reasons though, this often results in a weird counting where the first placeholder starts from a high number like 15 (eadv-in-content-15), resulting in many ads not being served as the ad-network ignores any placeholder with a number higher than 16. This doesn’t always occur, and it’s more common on longer posts.

    Example of an affected post.

    Example of an unaffected post (counting is normal, starting from 2-3).

    What could be causing this? Thank you in advance for your support.

    • This topic was modified 2 years, 2 months ago by simsworldit.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Spacetime

    (@spacetime)

    Hello,

    this happens when the theme calls the_content action filter more than once. In your case it seems the first call is not used for the frontent but for some other purpose, however, the plugin is called, blocks are inserted and block counters increased:
    https://adinserter.pro/faq/how-ad-inserter-works#automatic-insertion

    The latest develpoment version supports an additional parameter index in the shortcode where you can specify the counter offset, for example:

    [ADINSERTER counter='block' index="-14"]

    https://downloads.wp.xz.cn/plugin/ad-inserter.zip

    Thread Starter simsworldit

    (@simsworldit)

    Hi and thank you for your reply.

    I added that additional parameter to the shortcode, though while it worked around the issue on affected posts, posts where blocks were fine in the first place had a negative count, so I removed it for now.

    I have no idea what triggers the filter multiple times since I didn’t incorporate any unusual element on those pages/posts where it happens. The only pattern is that the longer the post is, the higher is the chance it happens and the higher the number the counter starts from is.

    • This reply was modified 2 years, 2 months ago by simsworldit.
    • This reply was modified 2 years, 2 months ago by simsworldit.
    • This reply was modified 2 years, 2 months ago by simsworldit.
    Thread Starter simsworldit

    (@simsworldit)

    Hi again,

    I was told by the theme’s author that I can fix it by prioritizing the plugin’s function that is responsibile for calling the filter by specifying a priority number (hopefully I got it right). Now unfortunately I’m not a developer, so I’m not sure what to do here. The only thing I’ve tried is changing the plugin priority in the general options, which is 9999 by default.

    Setting any single digit number makes the plugin stop working though, meaning that no block appears on the frontend.

    • This reply was modified 2 years, 2 months ago by simsworldit.
    • This reply was modified 2 years, 2 months ago by simsworldit.
    • This reply was modified 2 years, 2 months ago by simsworldit.
    Plugin Author Spacetime

    (@spacetime)

    Default Ad Inserter plugin priority (processing order) is 99999. It is used to specify the order in which the plugin functions are executed. Lower numbers correspond with earlier execution.

    Maybe you can solve the issue by setting the Filter using Content processing counter to 2 (remote debugging doesn’t seem to be enabled so I can’t check):
    https://adinserter.pro/documentation/additional-block-settings#filter

    Thread Starter simsworldit

    (@simsworldit)

    Can’t believe it. It worked. Thank you so much.

    Plugin Author Spacetime

    (@spacetime)

    🙂

    Thank you so much.

    Please say it here:
    https://ww.wp.xz.cn/support/plugin/ad-inserter/reviews/#new-post

    Thank you!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Weird block counting’ is closed to new replies.