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.

deaktivate Paging via code

  • Hello support team, is it possible to deactivate the paging on category page via code?

    The reason is that I implement the infinite scrolling and now I do not need this paging “1 2 3 4 more”.

    Kind regards
    Jens

  • Hi Jens,

    Could you provide the URL of your site so I can take a look?

  • Hi Alvind,

    unfortunately my page isn’t online until now.
    I uploaded a screenshot on Google drive.

    https://drive.google.com/file/d/1MbwDOez-oGlweMcE3MwMpXBtV_m8cnnO/view?usp=drive_link

    I want deactivate the paging on my category site.

  • The pagination should not show if it’s an archive page with infinite scroll.

    I will have to examine the page to know what is wrong.

  • Hi Ying,
    that is right but I didn’t us your generategpress option because I can’t overwrite the filtering in the category list.
    I implemented a own infinite scrolling but I can’t remove the paging.

  • Oh ok, I don’t think I can remove the pagination, but should be able to hide it using this CSS:

    :is(.blog,.archive) .paging-navigation {
        display: none;
    }
  • Hi Ying,

    If I enable infinite scrolling in GeneratePress, the software also has to remove paging via code. I’d like to do that too. Could you provide me with the code snippet?

    Via css is not SEO friendly.

    Kind regards
    Jens

  • If I enable infinite scrolling in GeneratePress, the software also has to remove paging via code. I’d like to do that too.

    If you use GP’s infinite scroll, it does not contain pagination.

    If you are NOT using GP’s infinite scroll, then it’s not possible to remove GP’s pagination, unfortunately!

    It can only be done by CSS.

  • Hi Ying,

    I don’t understand that. If I enable the GP’s infinite scroll option, the software also has to disable paging. I just need this code from you to do the same.

    Unfortunately, I can’t use GP’s infinite scroll because I can’t filter. Would it help to gain admin access to my site to better understand this?

    Can I possibly remove the paging from the template?

    Kind regards
    Jens

  • Can you try PHP snippet? The idea is to set posts per page to -1 (show all posts) on the blog page.

    add_action('pre_get_posts', 'custom_blog_posts_per_page');
    function custom_blog_posts_per_page($query) {
        if (( is_home() || is_archive())  && $query->is_main_query() && !is_admin()) {
            $query->set('posts_per_page', -1);
        }
    }
  • Thx, that works great.

  • Glad to hear that 🙂

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