Ordering posts by date, category
-
Here’s what I want to do:
List my posts by date (which is done by default), but then sub-order the posts published on the same date by category.So let’s say I have 10 posts in my DB; 5 are from April 1st and 5 are from April 2nd. The 5 posts from April 1st are from 5 different categories, the 4 posts from the 5th are from the same categories but were posted in a different order.
Right now this is what I see on the blog:
April 2nd, 2008
Post 10 (cat id 3)
Post 9 (cat id 5)
Post 8 (cat id 2)
Post 7 (cat id 4)
Post 6 (cat id 1)April 1st, 2008
Post 5 (cat id 1)
Post 4 (cat id 3)
Post 3 (cat id 4)
Post 2 (cat id 2)
Post 1 (cat id 5)But this is what I want:
April 2nd, 2008
Post 6 (cat id 1)
Post 8 (cat id 2)
Post 10 (cat id 3)
Post 7 (cat id 4)
Post 9 (cat id 5)April 1st, 2008
Post 5 (cat id 1)
Post 2 (cat id 2)
Post 4 (cat id 3)
Post 3 (cat id 4)
Post 1 (cat id 5)Is there a way to sort and order the posts twice? Once by date, then by category by date?
I’ve looked into the query_posts tag and can order all my posts by date and title, but the ‘category’ parameter has been gone since v 2.6; on top of that, is it even possible to order by two different parameters like I want to or will this call for a special query?
Thanks!
- The topic ‘Ordering posts by date, category’ is closed to new replies.