How to list oldest posts first
Blogs traditionally have shown newest posts first: that ease of finding what's new is arguably what's made them so popular with both writers and readers. But there are times when you'll want to list posts in the other order: oldest first. If you're using WordPress as a content management system and building content in categories, your first post might be the most important, so you'll want it at the top of the category archive, for example.
Happily you only need to add one line of code to do this, and here it is:
<?php query_posts($query_string."&order=ASC"); ?>
Add this to the theme file you want to change: normally search.php for search results, archive.php for category and date archives, or index.php for the front page (this might vary according to how your theme is organised). You need to add it before the loop starts, so look for <?php if (have_posts()) : ... and add it before that.
Tags: query_posts, WordPress
Posted by Sue on April 28, 2009 in WordPress.








you don't know how long I have search for that bit of code,, thanks!
Wow it works great! Thank you so much. I used it on my blog as I wanted oldest posts first in the categories
Thanks again!