WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Earliest post on top in category archives? (4 posts)

  1. ampersand
    Member
    Posted 8 years ago #

    I'm sure there's a simple way to do this, but I've been searching and having no luck.

    1) How can I create a category archive template for a theme that didn't come with one? (I'm using a modified version of the "WordPress classic" theme that came with WordPress.)

    2) How can I reverse the order in the category archives, so instead of having the newest post on top, the oldest post will be on top and the newest will be on the bottom?

    This is for a blog I use to present the pages of my comic book (you can see the blog here). What I'd like is to be able to give readers the option of either reading the individual pages, or of reading a bunch of pages on the same webpage by scrolling down, from the earlier pages to the more recent pages.

  2. wyrd33
    Member
    Posted 8 years ago #

    Is this what you're looking for?
    http://codex.wordpress.org/Category_Templates

  3. wyrd33
    Member
    Posted 8 years ago #

    Doing some further research, I believe you can use a typical category.php (for your Category Template), then at the top (before your WordPress loop), use the WP_Query object to specify a new order. I haven't tested, but I believe you would do it like so:

    $wp_query->set("order", "ASC");

    More info here:
    http://codex.wordpress.org/Function_Reference/WP_Query

  4. ampersand
    Member
    Posted 8 years ago #

    Thank you! Trying that didn't work for me, but it did set me in the right direction.

    I realized that what I really want is for the entire blog - including all the categories and the main page - to present posts in chronological order, earliest on top (some people call this "chapter" order).

    What worked for me was editing the wp-blog-header.php file, and inserting this line:

    $order='ASC';

    Directly above this line:

    $wp_did_header = true;

    Thanks very much for your help!

Topic Closed

This topic has been closed to new replies.

About this Topic