- This topic has 13 replies, 2 voices, and was last updated 3 years, 4 months ago by
David.
-
AuthorPosts
-
November 24, 2022 at 2:00 am #2430566
Ghazi
Hello guys
How do I modify the pagination buttons in my template?
I am using a search templateMy page number looks like this
https://imghostr.com/5543c9_7ezI want to change it like this
https://imghostr.com/a48375_kgxNovember 24, 2022 at 2:20 am #2430613David
StaffCustomer SupportHi there,
you can try adding this CSS:
#nav-below .nav-links > *:not(.dots) { display: inline-flex; justify-content: center; margin: 0; padding: 0 10px; line-height: 40px; min-width: 40px; border-radius: 6px; background-color: #f00; color: #000; } #nav-below .nav-links > *:not(.dots):hover, #nav-below .nav-links .current { background-color: #00f; color: #fff; }And if you want to change the length of the page numbers displayed. You can add this PHP Snippet:
add_filter( 'generate_pagination_mid_size','tu_increase_pagination_numbers' ); function tu_increase_pagination_numbers() { return 3; }Increase the
3to show more numbers.November 24, 2022 at 2:29 am #2430633Ghazi
Thank you for the quick response to my question
But I want to make the buttons in the center
And I want to remove the dots between the numbers as shown in the picture
https://imghostr.com/b638b8_l7wNovember 24, 2022 at 2:47 am #2430663David
StaffCustomer SupportAdd this CSS to center it:
.nav-links { text-align: center; }To remove the dots – in the PHP Snippet i provided simply return a really high value eg.
999
However you need to consider whether there is enough room for all the page numbers to be displayed.November 24, 2022 at 2:56 am #2430674Ghazi
Thank You
The value cannot be raised to this number
I mean, I want the numbers to show up, say 1 2 3, and then the next
When you click next, 2 3 4 appears, 1 disappears, and so on
I hope you understand what I meanBearing in mind that the dots disappear
November 24, 2022 at 3:31 am #2430740David
StaffCustomer SupportGP uses the core
the_posts_paginationfunction to display the nav, and that is not an option.
You can only define Start, End and Mid size values and whether to display the Next and Previous pages.November 27, 2022 at 3:27 am #2436840Ghazi
It’s sad that I can’t remove these points while still keeping the counter clean
November 27, 2022 at 5:22 am #2436947David
StaffCustomer SupportYeah its a pity WP didn’t add it.
Its a bit of a hack, but you could try adding this CSS:#nav-below .page-numbers:not(:is(.next,.prev)) { display: none; } #nav-below .page-numbers.current, #nav-below .page-numbers.current+*, #nav-below .page-numbers.current+*+*{ display: inline-block; }It will hide any number except for the current number and the 2 numbers that come after it.
November 27, 2022 at 6:34 am #2437029Ghazi
Very cool, the problem has been solved
Is it possible to apply these previous codes to other pages?
Meaning on all pages of the site that have paginationSuch as not applied to the attached page
November 27, 2022 at 7:19 am #2437084David
StaffCustomer SupportTry changing it to:
:is(#nav-below, .gb-query-loop-pagination) .page-numbers:not(:is(.next,.prev)) { display: none; } :is(#nav-below, .gb-query-loop-pagination) .page-numbers[class*="current"], :is(#nav-below, .gb-query-loop-pagination) .page-numbers[class*="current"]+*, :is(#nav-below, .gb-query-loop-pagination) .page-numbers[class*="current"]+*+*{ display: inline-block; }November 27, 2022 at 7:31 am #2437097Ghazi
Really cool this worked
But it seems that the numbers are not in separate boxes like the blog page
November 27, 2022 at 7:35 am #2437106David
StaffCustomer SupportIf you edit the Query Loop -> Paginiation block, select each of the buttons ( next, numbers, prev ) and in the Spacing settings add some left or right margin. This will add the space.
November 27, 2022 at 8:02 am #2437400Ghazi
Thank You David
November 28, 2022 at 4:05 am #2438655David
StaffCustomer SupportYou’re welcome
-
AuthorPosts
- You must be logged in to reply to this topic.