[Support request] infinite scroll

Home Forums Support [Support request] infinite scroll

Home Forums Support infinite scroll

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #1413089
    Anil

    Hi

    I have inserted a text box after every 2 posts on home page archive.

    Please guide how to add this custom text box after every 2 posts if I use infinite scroll…

    Regards.

    #1413272
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Try making your ad an <article> element instead of <div>.

    Let me know 🙂

    #1418038
    Anil

    Thanks Tom, it is working with some caveat.

    Ad Inserter Plugin OR GPP removes
    (adsbygoogle = window.adsbygoogle || []).push({});

    from

    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>

    in posts after initial 10 posts or first page….

    Any solution …

    #1418071
    Anil

    Hi Tom,

    I posted this at plugin support (removing-part-of-ad-unit), and @spacetime replied:

    Hello,

    the plugin does not remove any code.

    Your theme loads subsequent pages via ajax request, for example
    https://h___k.com/page/2/
    https://h___k.com/page/3/

    The pages contains inserted codes as configured in Ad Inserter.

    However, when the posts from the loaded pages are inserted into the homepage, the adsense javascript code seems to be removed. very likely the theme “cleans” the loaded code before adding it to the homepage.

    I suggesto to contact theme authors.

    #1418107
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    The theme itself doesn’t do any cleaning/sanitizing. It simply requests the <article> elements from the next page and loads them inline using Infinite Scroll: https://infinite-scroll.com/

    I don’t believe Infinite Scroll doesn’t any cleaning, either.

    If you navigate to /page/2 on your site, does the code exist?

    #1418211
    Anil

    yes, it shows ads on page 2 and after 10 posts same issue….

    #1419261
    Tom
    Lead Developer
    Lead Developer

    How are you adding the code in the first place?

    #1419367
    Anil

    with ad inserter

    #1419411
    Anil

    Hi Tom Plugin author replied

    However, when the posts from the loaded pages are inserted into the homepage, the adsense javascript code seems to be removed. very likely the theme “cleans” the loaded code before adding it to the homepage.

    Please check….

    #1419594
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    The theme doesn’t do any cleaning like that – it simply initiates infinite scroll and allows it to take over.

    It could be that infinite scroll itself is stripping the javascript – I haven’t tested it.

    Perhaps this is related?: https://wordpress.org/support/topic/insert-responsive-adsense-on-infine-scroll-pages/

    #1419837
    Anil

    Hi Tom

    Initially ads were not inserted on scroll as I was using div to add.
    After your suggestion I convereted div to article, it started loading but without script.
    It shows complete ad code but without script showing only <script></script>.

    It means adinserter started pulling ad-code.

    Either Plugin or Theme removing script code.

    1. Plugin author says plugin not removing / cleaning code.

    2. Theme author says theme not removing / cleaning code.

    3. Theme using third party code to implement scroll, and theme author unable to say about “infinite scroll” stripping the code or not.

    4. Link you guided not providing any solution.

    Any further suggestion….

    #1420773
    Tom
    Lead Developer
    Lead Developer

    The code isn’t being stripped out, it’s still there: https://www.screencast.com/t/6k2bjaBE0

    The ads simply aren’t displaying. I’m not an Adsense expert, so I’m not sure why that would be happening. Too many ads displaying on one page, maybe?

    #1420965
    Anil

    Dear Tom,

    Code is there, yes, but it is stripping this part from the code

    (adsbygoogle = window.adsbygoogle || []).push({});

    and empty opening and closing syntax of
    <script></script>

    so why this part (adsbygoogle = window.adsbygoogle || []).push({}); is stripped….

    #1421051
    Tom
    Lead Developer
    Lead Developer

    Seems to be common with AJAX loading: https://wordpress.org/support/topic/google-adsense-not-supporting-on-ajax-infinite/

    You could try adding some javascript to your site:

    1. Create a Hook Element:
    2. Select the wp_footer hook.
    3. Add your content:

    <script>
        var $container = jQuery( '#main article' ).first().parent();
    
        $container.on( 'append.infiniteScroll', function() {
            (adsbygoogle = window.adsbygoogle || []).push({})
        } );
    </script>

    4. Set your Display Rules.

    Again – not an Adsense expert, but it’s worth a shot.

Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.