WordPress.org

Support

Support » Themes and Templates » Display only One Category in Reverse Order

Display only One Category in Reverse Order

  • I have figured out that by adding following line before the loop:

    <?php get_header(); query_posts($query_string . "&order=ASC"); ?>

    category posts get displayed in reverse chronological order. I was trying to figure out how to make only posts in ONE (select) category display in reverse chronological order and have the rest from last to first, but that’s beyond my skill. I tried searching for answers big time but wasn’t able to find the solution. Somebody please help 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • Assumptions: category 4 post in post date ascending order, otherwise do not need to change the query!

    <?php
    get_header();
    if (is_category('4') ) {
    query_posts($query_string . '&order=ASC');
    }
    ?>

    Works a treat, thanks.

    This is exactly what i need as well… but where do I post the code? Which file?

    With the help of the Template Hierarchy article, determine what Template is displaying your posts (likely index.php or category.php) and put the code there. Watch out though, the answer used some of the code that Tranny described…

    Also might consider using the Query Posts Reloaded plugin.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Display only One Category in Reverse Order’ is closed to new replies.