StevenFX
Member
Posted 2 years ago #
I need to change the order in which posts are displayed on category pages from descending to ascending (older first). I quickly looked through the code for index.php (which I think displays the category pages) but was slightly confused because of the lack of indentation in my theme's code.
Can anyone help? My blog's info is:
Main URL: http://www.phreakyourgeek.com/
Page in question: http://www.phreakyourgeek.com/category/build-a-blog/
Theme: LightWord
To resort the order of posts, in your Category Template just before the line:
<?php if (have_posts()) : ?>
put this:
<?php query_posts($query_string . '&orderby=date&order=ASC'); ?>
The query_posts() article explains the arguments in detail.
If you don't have a category template, then may need to copy category.php or archive.php or index.php to category-build-a-blog.php so that the reordering happens ONLY on that particular category.
Related:
Stepping Into Template Tags
Stepping Into Templates
Template Hierarchy