Infinite Scroll of Jetpack with pagination problem

Asked

Viewed 35 times

0

In my Wordpress installation I am using the plugin JETPACK and its Infinite scroll Feature.

On the blog homepage, I’m using the pre_get_posts action and the filter infinite_scroll_query_args to change the Query and pull common posts and a custom post type.

The problem is that with this the pagination of the Infinite scroll breaks and only counts the pagination of the custom post type that I am using, but pulling both post types normally. Where the Infinite scroll was supposed to be activated 48 times, it only activates 8 times.

I’m using the following codes:

add_action( 'pre_get_posts', 'function_pre_post' );

function function_pre_post( $query ) {
    if ( $query->is_main_query() && $query->is_home() ) {
        $query->set( 'post_type', array( 'post', 'critica' ) );
    }
}

function jetpack_infinite_scroll_query_args( $args ) {
    $args['post_type']   = array( 'post', 'critica' );
    return $args;
}
add_filter( 'infinite_scroll_query_args', 'jetpack_infinite_scroll_query_args', 100 );

  • "only accounts for the custom post type pagination I’m using, "this on the home page? What you call "CPT I’m using"?

  • Yes it was the home page and ALSO the Archive, The Cpt I’m using is the "Critics". However I was using version 4.5 of the plugin, after upgrading the plugin to version 4.7.2 the paging back to work normally.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.