WordPress Jetpack infinite scroll isn’t firing

I have carefully followed these instructions at OttoPress, and read all the documentation at Jetpack.me. I feel like I understand what should work, but for some reason Infinite Scroll is not firing.

I have installed Jetpack onto my WordPress installation and disabled all features apart from Infinite Scroll.

Read More

enter image description here

I created a content.php, as per the recommendations at OttoPress, and my page (page-news.php) loads that content just fine, and as I’d expect. The code looks like this:

<div id="masonry">
  <?php while (have_posts()) : the_post(); 
    get_template_part( 'content', get_post_format() );                                      
  endwhile; ?>
</div>

With that all working correctly, I then added the following to functions.php:

function bones_infinite_loop_init(){
  add_theme_support( 'infinite-scroll', array(
    'footer'         => false,
    'type'           => 'scroll',
    'footer_widgets' => false,
    'container'      => 'masonry',
    'wrapper'        => false,
    'posts_per_page' => false
  ));
}
add_action( 'init', 'bones_infinite_loop_init' );

When that didn’t work, I even tried adding:

'render'         => 'bones_infinite_scroll_render',

And created a function with the post formatting in it.

I’ve also tried:

'type'           => 'click'

But nothing appears on the page, no extra posts are loaded when I scroll to the end of the page, and infinite-scroll does not appear as a class on the body element.

The are also no errors in the developer console.

What am I missing?

I’m wondering if it’s to do with any of the following:

  1. I’m trying infinitely scroll Custom Posts
  2. On page-news.php I have 'posts_per_page' => 3 and maybe that’s conflicting somehow?
  3. I’ve missed a crucial (but obvious) step in setting things up

Thanks for any help.

Related posts

Leave a Reply