Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Disable infinite scroll for certain pages

  • Hey there!

    I’m using WP Facet on one of my sites to be able to granularly filter my recipes. WP Facet doesn’t support infinite scroll though, and I can confirm that there are (albeit minor) issues when I use it with the corresponding option under Layout > Blog.

    Is it possible to disable infinite scroll for certain pages? I only use WP Facet on the Recipe-Index page and nowhere else, but I would still like to have the infinite scroll feature in archives, search results, etc.

    Cheers
    Philipp

  • Hi there,

    You can use this snippet:

    add_filter('option_generate_blog_settings', function($options) {
        if (is_page(array(42, 54, 67))) { // Replace with the page IDs
            $options['infinite_scroll'] = false;
            $options['infinite_scroll_button'] = false;
        }
        return $options;
    });

    Simply replace the numbers inside the array with the page IDs where you want to disable infinite scroll.

    Adding PHP: https://docs.generatepress.com/article/adding-php/

  • Hey Alvind,

    sorry for the late reply – your solution works like a charm, thanks!

    Cheers
    Philipp

  • You’re welcome!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.