My suspicion is that the template tag doesn’t behave as expected because of your non-standard template file names.
On a normal setup (using either the archive.php or Category_Templates to display category archives) the Template_Tags/posts_nav_link never displays posts from other categories when browsing a cat archive/listing.
Thread Starter
hilj
(@hilj)
Okay, that makes sense.
I simply tried to ad a number in the end, like this: single2.php, sidebar2.php no effect, it still browses trough all Posts.
What should I call them then? Or should I build it somehow differently?
Thank you for this.
I don’t see how you could do this through posts_nav_link(), as it’s really only ‘page’ aware. The portion of the posts query it builds off of is the part that lets it determine if any posts are extant for say previous links and the like.
Not knowing how these various posts types are discriminated and displayed in your code, I can only suggest rethinking how they are queried, say through the use of query_posts().
Thread Starter
hilj
(@hilj)
Ouch! I made a mistake. I was talking about the next_post_link and previous_post_link. I got mixed up when I searched with a previou_post_link and the result was the “next and previous links” article and not the “previous post link” article.
next and previous_post_link lets me exclude categories just as I wanted.
There’s one litle really basic thing I couldn’t figure:
<?php previous_post_link('← %link','past', FALSE, '18 and 17'); ?>
The link is named “past”, I would like to see a post title there. I know the %link is just that, but if I leave “past” empty, like this:
<?php previous_post_link('← %link','', FALSE, '18 and 17'); ?>
Nothing happens (obviously cause it’s empty) what should I put there to ignore it?
Thanks a lot for these. And sorry for mixing up the mix up.
<?php previous_post_link('← %link','%title', FALSE, '18 AND 17'); ?>
That would provide the title of the (in this case previous) post as your link text.