0

Problem: Unable to change number of posts on Jetpack Infinite Scroll

Desired Result: Load 10 posts per infinite scroll instead of default 7

Theme: Twenty Fifteen (Child)

Tried:

1) Looking for a setting in Jetpack Infinite Scroll menu - nothing there

2) Adding this code to child functions.php

function twenty_fifteen_infinite_scroll_init() {
    add_theme_support( 'infinite-scroll', array(
       'posts_per_page' => 10,
    ) );
}
add_action( 'after_setup_theme', 'twenty_fifteen_infinite_scroll_init' );
1

Found the code that works here:

https://themeshaper.com/2013/10/08/how-to-override-jetpack-infinite-scroll-settings-in-a-child-theme/

 /*
 * Change the posts_per_page Infinite Scroll setting from 10 to 20
 */
function my_theme_infinite_scroll_settings( $args ) {
    if ( is_array( $args ) )
        $args['posts_per_page'] = 20;
    return $args;
}
add_filter( 'infinite_scroll_settings', 'my_theme_infinite_scroll_settings' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.