Archived topic
How to enable infinite scroll without a load more button option in archives
3 replies · Started by Halil on March 29, 2023
Hi,
I enabled infinite scroll with "use buttons to load more posts" option enabled. It works on blog page and archive pages.
I'm using content template for my post category archive and search results. Is it possible use infinite scroll on these pages without load more button enabled?
I want to keep "load more.." button on my blog but not on category archive/search results pages.
I found the code below in the forum, it works for search results, what should I add to it to make it work on cetagory archive?
add_filter( 'option_generate_blog_settings', 'lh_custom_search_results_page_settings' );
function lh_custom_search_results_page_settings( $options ) {
if ( is_search() ) {
$options['infinite_scroll'] = true;
$options['infinite_scroll_button'] = false;
}
return $options;
}
sorry for keeping you busy! I found it in another forum post : )
add_filter( 'option_generate_blog_settings', 'lh_custom_search_results_page_settings' );
function lh_custom_search_results_page_settings( $options ) {
if ( is_search() || is_category() ) {
$options['infinite_scroll'] = true;
$options['infinite_scroll_button'] = false;
}
return $options;
}
Glad to hear you found the solution!!