[Support request] Remove infinite scroll navigation on other categories

Home Forums Support [Support request] Remove infinite scroll navigation on other categories

Home Forums Support Remove infinite scroll navigation on other categories

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #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.

    #2377361
    David
    Staff
    Customer Support

    Hi there,

    you can use the option_generate_blog_settings filter:

    https://docs.generatepress.com/article/option_generate_blog_settings/

    #2378812
    Ryan

    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.

    #2379717
    David
    Staff
    Customer Support

    That 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;
    }
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.