I am trying to add jetpack infinite scroll support with different settings to different pages on my Wordpress site. For instance I want the blog page to reload 12 articles every time your scroll down, and I want the shop page to reload 20 products every time. So I tried to do this, but it is not working, somehow the conditions are just being ignored.
Does anyone have an idea on what is going on?
function quailstudio_infinite_scroll_init() {
if ( is_home() || is_archive() || is_category() ) {
add_theme_support( 'infinite-scroll', array(
'type' => 'scroll',
'container' => 'content',
'wrapper' => false,
'render' => 'render',
'posts_per_page' => 12,
) ); } elseif ( is_shop() ) {
add_theme_support( 'infinite-scroll', array(
'type' => 'scroll',
'container' => 'main',
'wrapper' => false,
'render' => 'render',
'posts_per_page' => 20,
) );
} else { remove_theme_support( 'infinite-scroll','' );
} }
add_action( 'after_setup_theme', 'quailstudio_infinite_scroll_init' );
Aucun commentaire:
Enregistrer un commentaire