Archived topic
Next/prev within specific category only - arrows back to front
7 replies · Started by Giselle on January 28, 2022
Hi,
I'm using the code snippet below to show Next/Previous arrows in a specific category only:
add_filter( 'generate_category_post_navigation', '__return_true' );
But, the arrows are pointing in the wrong direction: forwards for previous posts and backwards for next post.
Thanks for your help.
Giselle
Link to Category page below!
Hi there,
are you saying the direction of the arrows switch when you added that snippet ?
Hi David,
No. I just disabled the snippet and the arrows are the same. if you click on the first post the arrow to the next is the wrong way round (pointing backwards not forwards), if that makes sense?
Thanks,
Giselle
Yeah thats how WP operates when posts are listed in date order.
When you select the first post, thats the very latest post, so the Link you see at the bottom is actually the Previous Link.
You can if you like redesign the post navigation using a Block Element:
https://docs.generatepress.com/article/block-element-post-navigation/
Hi David,
Thanks. I thought that might be the case, but in terms of nav it struck me as odd! I'll take a look at your block nav.
Thanks for your help,
Giselle
Yeah - its a bit of a mind bender that i try not to think too much on :)
Let us know how you get on!
I did wonder if I'd been staring at my screen too long when I notcied it :-)
Will do.
Thanks!