Site logo

[Resolved] numbers in pagination

Home Forums Support [Resolved] numbers in pagination

Home Forums Support numbers in pagination

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1863626
    Rafał

    Hello,

    How to change default pagination view.

    For now I have: 1 2 … 4
    What I want to achieve: 1 2 3 4 (and more when I will publish more – without cutting numbers)

    #1863670
    Leo
    Staff
    Customer Support

    Hi there,

    Try this filter:
    https://docs.generatepress.com/article/generate_pagination_mid_size/

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

    Just set it to a very large number 🙂

    #1864093
    Rafał

    you are the best

    #1865082
    Leo
    Staff
    Customer Support

    Thanks 🙂

    #2551724
    Ted

    I tried using generate_pagination_mid_size to limit the number of pagination buttons to just 9 (including the arros), and it doesn’t seem to be working. If you take a look at https://www.thegatewaypundit.com/?query-c82e90c0-page=5 for example, you’ll see 11 pagination buttons — which is hard to get to look right on mobile. So maybe like https://www.thegatewaypundit.com/?query-c82e90c0-page=5 but remove #3 and #7 …

    Is this possible with generate_pagination_mid_size or would I need to exploit a different filter?

    Thanks!

    #2551872
    Ying
    Staff
    Customer Support

    Hi Ted,

    Unfortunately, GB doesn’t have such a filter to alter the pagination, but I’ve informed our developers and they will try to create a filter for this.

    For now, can you try this CSS?

    .gb-query-loop-pagination :is(a.gb-button.page-numbers[href*="page=3&"], a.gb-button.page-numbers[href*="page=7&"]) {
        display: none;
    }
    #2552096
    Ted

    Thanks, Ying. I’ll try some CSS to hide the extra pagination buttons. I’m not sure your CSS will work on all permutations of the pagination, but it is giving me some helpful clues on how to fix this.

    #2552415
    David
    Staff
    Customer Support

    Hi there,

    give this CSS a shot.
    It will place the next/previous items on their own row.

    @media(max-width: 768px) {
        .gb-query-loop-pagination .gb-button {
            flex: 1 0 max-content;
        }
    
        .gb-query-loop-pagination .gb-button:first-child,
        .gb-query-loop-pagination .gb-button:last-child {
            order: -1;
            flex: 1 0 calc(50% - 1px);
        }
    }

    Does that work ?

    #2553154
    Ted

    David, you are scary good at CSS. I love solving problems with CSS, and I think for now your solution might be the best option.

    #2553341
    David
    Staff
    Customer Support

    Well thank you 🙂
    I think it’s actually possible in the block editor ( with GB 1.7 ) without CSS, but you have to love a bit of CSS.

    Glad to be of help

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