With the help of the Template Hierarchy article, determine what Template is displaying your category archives (could be category.php or archive.php). Then edit that Template and add the same code you did to your index.php.
Hello Michael,
Thanks for the information.
I’ve had a read of the links you kindly provided and have found that the file I need to modify is indeed archive.php. I traced the identical line of code within archive.php as I had in the original (unmodified) index.php file:
<?php while (have_posts()) : the_post(); ?>
..and replaced this with the new code that gives me ascending post order in the blog page:
<?php $posts=query_posts($query_string . '&order=asc');
if (have_posts()) : while (have_posts()) : the_post(); ?>
However, when I go to view the pages I get the following error:
Parse error: syntax error, unexpected $end in /home/walletsm/public_html/wp-content/themes/walletsmarts/archive.php on line 186
I would appreciate any further pointers you can give me.
Molly
This line is not identical
<?php while (have_posts()) : the_post(); ?>
to
if (have_posts()) : while (have_posts()) : the_post(); ?>
go back and check that
I’ve just checked – you’re correct, the line of code is different (I’m just getting my ‘newbie’ head around PHP which might explain it!)
OK, (and just so that I can get my head around it) on my index.php page I had the following two lines of code:
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
I replaced both with:
<?php $posts=query_posts($query_string . '&order=asc');
if (have_posts()) : while (have_posts()) : the_post(); ?>
Which gave me ascending post order.
On my archive.php page I only have the second (albeit identical) line of code as that on the original index.php page:
<?php while (have_posts()) : the_post(); ?>
Don’t laugh, but I thought that I could just replace this single line (as I did in the index.php page) with the same ascending order code. Obviously not. ;o)
The following appears to work (Hooray!) though I wonder if you could cast your expert eye over the syntax for me just to confirm.
<?php $posts=query_posts($query_string . '&order=asc');
while (have_posts()) : the_post(); ?>
Thanks for taking the time; appreciated.
Molly
Looks fine. Thanks for the feedback. Will mark this resolved.