Index Loop – Most recent post in a specific category
-
I’d like to modify my Index Loop to only show the most recent post from a specific category.
I’m using Thematic as my parent theme. I have copied and pasted Thematic’s Index loop into my functions.php file. I then added the line:query_posts("category_name=blog&posts_per_page=1");
Two problems here…
1. Only the most recent post is showing on every page of the homepage (when you click “Older” and “Newer” posts from the homepage)
2. For some reason it’s showing as an excerpt.If I remove the query_posts line, it shows all the posts (including posts in ‘blog’ category) in full length. For some reason throwing in that query_posts is doing some wonky stuff. If I remove the category_name part, it will show the most recent post on the entire website in full length, but then issue #1 still happens.
Full Loop below
[code moderated as per Forum Rules - please use the pastebin]
Much thanks in advance.
- The topic ‘Index Loop – Most recent post in a specific category’ is closed to new replies.