WORDPRESS: How to Display Chosen Category in Reverse Order

Discussion in 'PHP' started by muncle, Mar 16, 2009.

  1. #1
    I have figured out that by adding following line before the loop:

    <?php get_header(); query_posts($query_string . "&order=ASC"); ?>
    Code (markup):
    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. Does somebody know what to do so only one chose category is displayed in reverse order and all other are unaffected?
     
    muncle, Mar 16, 2009 IP
  2. MeetHere

    MeetHere Prominent Member

    Messages:
    15,399
    Likes Received:
    994
    Best Answers:
    0
    Trophy Points:
    330
  3. muncle

    muncle Guest

    Messages:
    1,195
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    0
    #3
    cheers, I'm looking for a hard coded solution, too many plugins already :)
     
    muncle, Mar 16, 2009 IP
  4. Pixelrage

    Pixelrage Peon

    Messages:
    5,083
    Likes Received:
    128
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Does this really work? I've been looking to do this for a long time... a few programmers told me it couldn't be done
     
    Pixelrage, Mar 16, 2009 IP
  5. YIAM

    YIAM Notable Member

    Messages:
    2,480
    Likes Received:
    240
    Best Answers:
    0
    Trophy Points:
    280
    #5
    if that code works then create a template page category-ID.php adding that code..

    ID= category id.
     
    YIAM, Mar 16, 2009 IP
  6. muncle

    muncle Guest

    Messages:
    1,195
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I found out the answer to this:

    <?php
    get_header();
    if (is_category('4') ) {
    query_posts($query_string . '&order=ASC');
    }
    ?>
    Code (markup):
    Above example of course assumes it's Category #4 you want in ascending order.
     
    muncle, Mar 17, 2009 IP