- This topic has 3 replies, 2 voices, and was last updated 5 months ago by
David.
-
AuthorPosts
-
October 18, 2022 at 4:35 am #2377311
Ryan
I have infinite scroll enabled on my main articles category, but also have two other categories that use custom templates for the category page. I’m trying to disable the infinite scroll navigation link that goes to /page/2, /page/3, etc. because those pages are all identical to page 1 due to the templates being used.
Can the infinite scroll feature be filtered in some way to be active only on the articles category? I tried filtering the generate_blog_do_infinite_scroll_path function and also doing a custom function to override in my theme but neither worked. I know there is also some javascript involved so I don’t know if just removing the
<div class="infinite-scroll-path">
code would result in a JS error. Also, disabling the infinite scroll does not remove the links.October 18, 2022 at 5:24 am #2377361David
StaffCustomer SupportHi there,
you can use the
option_generate_blog_settings
filter:https://docs.generatepress.com/article/option_generate_blog_settings/
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/October 19, 2022 at 7:50 am #2378812Ryan
Thanks that worked great to remove the page navigation. Only issue is when removing the infinite scroll, it also removes the CSS that enables the ‘generate-columns’ code like ‘tablet-grid-50’, ‘mobile-grid-100’, etc. I tried using $options[‘column_layout’] = true but that did not add the CSS back in. Is there a way to load the /gp-premium/blog/functions/css/style.min.css and also disable infinite scroll? I’m guessing that would have to be a separate wp_enqueue_style dependent on the archive loading?
UPDATE: You can disregard unless there is a sleeker solution. The conditional wp_enqueue_style on the columns.min.css file worked fine.
October 20, 2022 at 2:15 am #2379717David
StaffCustomer SupportThat is odd, this works for me, and doesn’t affect the columns:
add_filter( 'option_generate_blog_settings', 'lh_custom_search_results_page_settings' ); function lh_custom_search_results_page_settings( $options ) { if ( is_category(array(12,15)) ) { $options['infinite_scroll'] = false; } return $options; }
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.