Site logo

Archived topic

numbers in pagination

9 replies · Started by Rafał on July 20, 2021

Viewing posts 1–10 of 10

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)

you are the best

Thanks :)

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!

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;
}

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.

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 ?

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.

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

This archived topic is closed to new replies.