Display only One Category in Reverse Order (5 posts)

  1. Tranny
    Posted 7 years ago #

    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 :)

  2. MichaelH
    Posted 7 years ago #

    Assumptions: category 4 post in post date ascending order, otherwise do not need to change the query!

    if (is_category('4') ) {
    query_posts($query_string . '&order=ASC');
  3. Diarmuid
    Posted 7 years ago #

    Works a treat, thanks.

  4. ridewithjoe
    Posted 7 years ago #

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

  5. MichaelH
    Posted 7 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic