Retrieving Only Latest Post from a Category
-
OK, I give up. I’m stupid, blind or incompetent or WordPress’ documentation of its built-in template tags is abysmal. I’ve spent an hour looking for an answer to this question. (Where in the world is the full syntax of the query_posts function documented?)
I need to retrieve and display the most recent post in a given category. I thought this should be easy because somehow I got the impression that getting just the most recent message is the default of query_posts(). So I tried:
query_posts(‘category_name=Upcoming Lessons’)
Nothing is returned but neither is an error generated. So I tried:
query_posts(‘category_name=Upcoming Lessons&posts_per_page=1’);
Same result. No display, no error.
I have read everything I can find in the Codex on query_posts and have found zero help.
Anyone care to point out where I’m doing something wrong?
- The topic ‘Retrieving Only Latest Post from a Category’ is closed to new replies.