Conditional tag for next/previous posts?
-
I’m not very good with PHP, so I can’t ascertain it from the source itself. Can someone please tell me: what should I use as an ‘if’ when checking to see if there’s a previous/next post?
This is something like the code I’d like to use:
<?php if(!$post->post_previous) {
next_post('%','Next »', 'no');
} else if(!$post->post_next) {
previous_post('%','« Previous', 'no');
} else {
previous_post('%','« Previous', 'no'); :; next_post('%','Next »', 'no');
} ?>
Pretty much, if there is a previous post but no next post, show only the previous; if there’s a next but no previous, show only the next; if there are both next and previous posts, show both with a : seperator. I hope this is clear enough, because I’m afraid I’ve muddled the question up too much.
- The topic ‘Conditional tag for next/previous posts?’ is closed to new replies.