- This topic has 13 replies, 2 voices, and was last updated 1 year, 7 months ago by David.
-
AuthorPosts
-
June 21, 2018 at 5:51 am #605136artie
Hi!
I’ll be ambitious today.
How can I customize blog pagination? Let’s say, something similar to what you have here on the forum. And is it possible to change “Next” label to something like “Older posts” ?
June 21, 2018 at 9:39 am #605426DavidStaffCustomer SupportHi.
you can use this CSS to style the pagination:
.page-numbers { padding: 5px 10px; box-sizing: border-box; border-radius: 5px; border: 1px solid; text-align: center; }
Just checking to see if there is a filter to change the Prev / Next titles with Tom and Leo.
June 21, 2018 at 10:39 am #605484artieThat looks much better. Thank you. I’ll play around with it later.
Meanwhile I hope I can ask one more question. This one about single post navigation. My idea was to have one on the left side and one on the right side. In older post I found this code from Tom:
.post-navigation { font-size: 20px; } .post-navigation .nav-previous, .post-navigation .nav-next { display: inline; padding: 0 20px } .nav-next .next:before { display: none; } .nav-next .next:after { content: "\f105"; font-family: FontAwesome; padding-left:10px }
I messed around with it but couldn’t get it right. Plus with paddings and margins it pushed end of the right one down to the left. And I suppose it is possible for these navigations to align automatically and nicely when post titles are shorter or longer? As in when I aligned normal length title, shorter title appeared closer to center, and longer title had its end cut down to the left.
June 21, 2018 at 11:21 am #605520DavidStaffCustomer SupportYou can try some flexbox like so:
.site-main .post-navigation { display: flex; justify-content: space-between; flex-wrap: wrap; } .site-main .post-navigation .nav-previous, .site-main .post-navigation .nav-next { display: inline; }
June 21, 2018 at 11:59 am #605534artieThat is awesome. In combination with parts from that Tom’s code everything works great.
Thank you very much.If it’s possible to change prev/next labels then I think I’ll be done with navigations for a long time. π
June 21, 2018 at 12:28 pm #605545DavidStaffCustomer SupportOh yeah that one. Well ‘Older Posts’ and ‘Newer Posts’ are already there so you can use this code in place of the original pagination styling:
.paging-navigation { display: flex; } .paging-navigation .nav-next, .paging-navigation .nav-previous { display: block; } .paging-navigation .nav-previous { margin-right: 5px; } .paging-navigation .nav-next { order: 1000; margin-left: 5px; } .page-numbers.prev, .page-numbers.next { display: none; } .page-numbers, .paging-navigation span { padding: 5px 10px; box-sizing: border-box; border-radius: 5px; border: 1px solid; text-align: center; }
June 21, 2018 at 12:55 pm #605568artieWell, that kinda works. What about something like this:
if that image will show…
June 21, 2018 at 9:43 pm #605747TomLead DeveloperLead DeveloperYou can change the Next and Previous text with a couple filters:
add_filter( 'generate_next_link_text', function() { return 'Older Posts'; } ); add_filter( 'generate_previous_link_text', function() { return 'Newer Posts'; } );
June 22, 2018 at 10:09 am #606247artieAwesome, it’s perfect.
Thank you Tom π
June 22, 2018 at 1:04 pm #606362TomLead DeveloperLead DeveloperYou’re welcome! π
September 12, 2022 at 8:13 am #2340731ErolHi Super Team,
I don’t know whether I am doing wrong by raising a related question on this post instead of creating a new support ticket. Many thanks for your great support π I cannot figure out why the first page number on the pagination has no padding on the left despite the code. Please check @ https://happy.websmith.cc/blog/ the funny thing is when I click page 2 and 3 the same problem does not occur and all 3 pages look nice but when I click on page 1 again the padding gets lost again. same thing happens when I click on the menu item “BLOG”
September 12, 2022 at 8:30 am #2340757DavidStaffCustomer SupportHi there,
try adding this CSS:
#nav-below .nav-links > * { padding: 0 5px; }
This will overcome some of the GP CSS that removes the left padding from the first link.
September 12, 2022 at 8:46 am #2340784ErolSuperfast solutions by David as usual π
It worked. Many thanksSeptember 12, 2022 at 8:56 am #2340795DavidStaffCustomer SupportGlad to be of help!!
-
AuthorPosts
- You must be logged in to reply to this topic.