tags:

views:

23

answers:

1

I checked Google and went through the Wordpress template tags but I still can't figure this out - in the single.php template file, which is the one used to display a specific post, how do I check whether this post is the most recent one OR the oldest post? Essentially I need to know whether this is first or last post out of all my posts.

+1  A: 

If you just want to check for their existence and don't need the link, you should use get_previous_post and get_next_post. They don't apply unnecessary formatting that you would ignore if you just use it in an if test. You can still get a link from the post object it returns by passing it to get_permalink.

Jan Fabry
Thank you.. however as you can see above under my comments, I figured it out 2 minutes after I wrote the question! I just couldn't find the function soon enough. I'll give you credit anyway tho!
jeffkee