Jetpack Infinite Scroll problem
-
I can’t seem to get Infinite scrolling working on a custom archive page. It seems to me it’s not picking up the arguments from the add_theme_support call. Here’s the code:
/** * Add theme support for infinite scroll. * * @uses add_theme_support * @return void */ function twenty_twelve_infinite_scroll_init() { add_theme_support( 'infinite-scroll', array( 'container' => 'catalogue-section', 'render' => 'my_child_infinite_scroll_render', 'posts_per_page' => get_option( 'posts_per_page' ), 'wrapper' => false, 'type' => 'scroll', ) ); } add_action( 'after_setup_theme', 'twenty_twelve_infinite_scroll_init' ); function my_child_infinite_scroll_render() { while ( have_posts() ) : the_post(); // Format of a catalogue entry is defined in catalogue-entry.php get_template_part( 'catalogue-entry', get_post_type() ); endwhile; }
The layout of the page shows entries from the initial custom posts correctly. However, when the second set of posts is called, it is not formatted correctly, as it’s no longer sitting inside the section that is targetted in my CSS to have multiple columns.
See the result here: https://www.staging5.shortkidstories.com/story/
I can see that Infinite Scroll is adding a div around the rendered posts even though in the add theme support call I set wrapper to false:
<div class="infinite-wrap infinite-view-2" id="infinite-view-2" data-page-num="2" role="region" aria-label="Page: 2.">
Also it wasn’t picking up my rendering call, so I had to update the default content.php to get the correct format of the entries. I wonder can anyone see why the add_theme_support parameters for infinite scrolling are not being picked up?The page I need help with: [log in to see the link]
- The topic ‘Jetpack Infinite Scroll problem’ is closed to new replies.