I have my tags in one of three categories. I would like to sort the posts first by category then by date. So all of category A, newest to oldest, then category B, newest to oldest and so on. I was thinking I need three separate loops, but I’m not certain how to do it or what might be the best way? Do I need three different loops? Or can I somehow do it with one loop and do some sorting in the loop?
I’ve tried adding
<?php rewind_posts('category_name=cat_name'); ?> <?php while (have_posts()) : the_post(); ?>
before my loop but that didn’t show posts only from ‘cat_name’ so I’m sort of stuck.
- The topic ‘Sort Posts by Category’ is closed to new replies.