Site logo

Archived topic

2 Questions about paging on archive page

4 replies · Started by Cindy on November 11, 2017

Viewing posts 1–5 of 5

First of all, thank you for this theme, I used it for someone else's site a long time ago and I was currently having trouble with the theme on one of my own sites and found it again and forgot how much I loved it!

Ok so I'm just trying to figure something out, I have a glossary custom post type with a custom archive page, it's set to display 20 posts and there are currently only 4 pages. Paging all works great and I've added some CSS etc, but there are two things I'd like to change.

When I'm on page one, the links show 1 - 2 - ... - 4 - Next basically showing page 3 as a range of pages. When I'm on page 4 it's showing page 2 as a range too. Can I filter that somehow to just show the page number instead? Maybe only show the range if there are more than 10 pages or something?

The other thing is that I'd like to change the arrow thing on the previous/next items to either side of the page numbers to something else, maybe a FontAwesome icon to match the rest of the site. Is that possible? Thanks!

Hi there,

For the first issue, try this function:

add_filter( 'generate_pagination_mid_size', 'tu_alter_pagination_mid_size' );
function tu_alter_pagination_mid_size() {
    return 3;
}

Would you want to replace the Next/Previous text, or just add icons to it?

Thanks very much - it works well for the 4 pages but just to test (as I'll be adding to this glossary) I just dropped the post per page count down to 10 so I have eight pages and it does the same on page 3 where it shows all 8 pages but goes 6 - ... - 8 But I should be able to bump that up to 'return 10' to keep all the page numbers visible until I get a lot more, right? Then if I end up with 20 pages I can drop it back down again. So I think I'm good there.

As for the Next/Previous, I was thinking about maybe just adding an icon where the arrow is now, it's currently like Next → but to conserve space (since I'm showing all those page numbers ha!) I'm thinking about just using left/right icons and ditching the text altogether. Probably like fa-arrow-circle-left/right would work.

Thanks again for all the help, I've been snooping through the forums and picking up on how to do other things so hopefully won't have to bother you too much! :)

Hey Tom, just figured out I could change the Next/Previous buttons by modifying the filter function to generate_next_link_text (and previous) so I'm all sorted I think. I'm going to mark this resolved, thanks!

Awesome! Glad you got it all working :)

This archived topic is closed to new replies.