• Hello,
    I have a twenty ten theme, and am trying to have the order of posts in the category archives in reverse-chronological order (earliest posts first)
    I want to do this just for category archives and not globally.

    Any ideas?

    Thanks much!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Do not edit the Twenty Eleven theme. It is the default WordPress 3.2 theme and having access to an unedited version of the theme is vital when dealing with a range of site issues.

    Create a child theme for your customisations. Once your child theme is active, see Category_Templates and query_posts.

    Create a child theme for twenty ten, then copy across loop.php to the child theme, rename the copied file loop-category.php

    Open the file and before these lines:

    <?php /* If there are no posts to display, such as an empty archive page */ ?>
    <?php if ( ! have_posts() ) : ?>

    Add a line to reverse the sort order!
    <?php query_posts($query_string . "&order=ASC"); ?>

    So you have:

    <?php /* Reverse the sort order ascending */ ?>
    <?php query_posts($query_string . "&order=ASC"); ?>
    
    <?php /* If there are no posts to display, such as an empty archive page */ ?>
    <?php if ( ! have_posts() ) : ?>

    Twenty Ten Child Theme:
    If you want to make it better and category specific, or do not want to code it yourself, I have already posted about this and there is a child theme, I use it for a series of posts like, part 1, part 2 etc:

    So if you have no other changes, job done!

    Twenty Eleven Child Theme (Page of Posts):
    This variation uses Custom Fields, and is a template page rather than index.pgp or category.php, and is for twenty eleven.

    HTH

    David

    Thread Starter yogidevotee

    (@yogidevotee)

    Thank you both so much!
    I will try that.

    thanks.

    Thread Starter yogidevotee

    (@yogidevotee)

    actually, when I do that, the sort order is reversed successfully, however any category archive page shows ALL posts.
    Was I also supposed to copy across anything else other than style.css and loop.php to the child theme?

    thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘how make category archive posts in reverse-chronological order’ is closed to new replies.