Category.php template. 3 excerpted, the rest listed
I created a custom category.php template because I’d like to display the latest 3 posts of a particular category excerpted, and the rest of the post listed;
Last post – excerpt […]
Next to last post – excerpt […]
antepenultimate post – excerpt […]
I thought that I could do this with two loops, the first loop trimmed to 3 posts showing the excerpts. The second loop showing just a list with an offset of 3 posts.
The first problem is that query_posts is not working in category.php. Instead of quering the posts of the clicked category it fetches all posts of the blog.
Second, I founded this code to fecth the 3 las posts without using query_posts in this thread http://wordpress.org/support/topic/155668?replies=5
<?php $cat = get_the_category(); $cat = $cat; ?>
However, this code doesn’t work inside the loop and if I put it outside the loop trims to 3 posts both, the first and the second loop.
And here I am stuck. Can I trim the first loop and offset the second loop without query_posts?
- The topic ‘Category.php template. 3 excerpted, the rest listed’ is closed to new replies.