• Resolved michaelw90

    (@michaelw90)


    For some reason I can’t manage to get Jetpacks infinite scroll function to use any parameters or functions that I pass in.

    It does return more posts on scroll (default behaviour), but it does not put them in the right container, it uses the standard content format and it still shows the footer even though I’ve disabled it…

    Here’s the code I’m using in functions.php

    function kodeape_infinite_scroll_support() {
        // Enable Jetpack Inifinite Scroll Support
        add_theme_support( 'infinite-scroll', array(
            'container' => 'blog-loop',
            'render'    => 'kodeape_infinite_scroll_render',
            'footer'    => false,
        ) );
    }
    add_action( 'after_setup_theme', 'kodeape_setup' );
    
    function kodeape_infinite_scroll_render() {
        while ( have_posts() ) : the_post();
            get_template_part( 'content', 'blog_archive' );
        endwhile;
    }

    index.php

    <div id="blog-loop" class="blog-loop">
        <?php
        while ( have_posts() ) : the_post();
            get_template_part( 'content', 'blog_archive' );
        endwhile;
        ?>
    </div>

    Here’s the dev site – another problem I’m having is that the scroll won’t trigger with the containers on the site having overflow. So to see the problem, overflow must be removed from .st-container and .st-content. However, this I’ll probably be able to fix, as it’s just styling related..

    https://wordpress.org/plugins/jetpack/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    I had a look at your site, and it seems to work now. Have you managed to figure it out?

    Thread Starter michaelw90

    (@michaelw90)

    Hi Jeremy, yes I managed to figure out the problem. The add_theme_support( 'infinite-scroll' was already included in a separate file. It was overriding the code I put in functions.php, but it’s all good now. Thanks for taking a look 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Can't get Jetpack Infinite Scroll to use custom render template and arguments’ is closed to new replies.