Can't get Jetpack Infinite Scroll to use custom render template and arguments
-
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..
- The topic ‘Can't get Jetpack Infinite Scroll to use custom render template and arguments’ is closed to new replies.