Thread Starter
miaow
(@miaow)
Hmmm. Is this query too hard and everyone is scratching their heads? Or too easy and you’re waiting for me to stumble on it myself? Am getting nowhere fast.
;o)
I tried to modify the code in wp-blog-header.php, whose the codes after line 146 seem to deal with it. But, failed.
Thread Starter
miaow
(@miaow)
I am still hoping someone will have the answer. Anyone?
Anonymous
Miaow, if you find an answer to this issue, will you let me know? I too would like my archives to read “in order” rather than backward.
Er… let’s try that again so there’s actually contact information for me. (I am sillywoppat.) *sigh* 🙂 If you do find a solution, let me know. I know that there is a way to do this if you use thd dropdown method of the archives, but I haven’t found a suitable solution otherwise. I’m just not familiar enough with WP or PHP to be of any use, myself.
Coming in a bit late, but I was able to get ascending monthly archives in WP 1.2 by appending:
&order=ASC
…to the rewrite rules in .htaccess that call index.php with the archive parameters. With my particular permalink configuration, my new rewrite rule is:
RewriteRule ^([0-9]{4})/?([0-9]{1,2})?/?([0-9]{1,2})?/?([_0-9a-z-]+)?/?([0-9]+)?/?$ /index.php?year=$1&monthnum=$2&day=$3&name=$4&order=ASC&page=$5 [QSA]
Does that help any?
In 1.5, I did a search for ‘ASC’ and found, among other things, these lines (459-460) in wp-includes/classes:
if ((empty($q['order'])) || ((strtoupper($q['order']) != 'ASC') && (strtoupper($q['order']) != 'DESC'))) {
$q['order']='DESC';
that I then changed to:
if ((empty($q['order'])) || ((strtoupper($q['order']) != 'ASC') && (strtoupper($q['order']) != 'DESC'))) {
$q['order']='ASC';
It also changed the order in the WP editing area and in my archives.php (I use nicer archives).
Did that do the trick?
– Bradley
miaow,
what is the code that you currently use to display the archives. I am sure that if you provide a link to the source for the archives page, someone will be better equipped to take a shot at showing you what change(s) to make.
Do you use a template tag to generate the monthly archive pages, or how do you do it? What theme do you use? The answers to these questions will be informative to someone like me who wants to help, but doesn’t know where to start 🙂
Has anyone found a solution to this meanwhile? I’m using 1.5 and would like to display my monthly archives in an ascending way. <?php wp_get_archives('type=monthly&order=ASC'); ?>
doesn’t help.
I took a look at the code and its easier than you think:
You can either pass the sorting-mode with the url:
http://www.yoursite.com/?m=200512&order=ASC
or change line 466 in classes.php (wp-includes) where WordPress reads just this argument. If you want to set Standard listing to ASC rather than DESC change the following:
if ((empty($q[‘order’])) || ((strtoupper($q[‘order’]) != ‘ASC’) && (strtoupper($q[‘order’]) != ‘DESC’))) {
$q[‘order’]=’DESC’;
Change into:
if ((empty($q[‘order’])) || ((strtoupper($q[‘order’]) != ‘ASC’) && (strtoupper($q[‘order’]) != ‘DESC’))) {
$q[‘order’]=’ASC’;
Hope that helps.
Rudi
Hi Rudi,
thanks for answering! But I’m afraid it doesn’t help, changing classes.php also changes the display on the entry page, and on the entry page I want the articles descending, the newest on top.
Your first solution doesn’t work either, I only get an error message and no page is found that way.
🙁
So I keep hoping WP 2.0 will offer a solution for this.
I’m sure there’s an easier way, but I’ve written a (VERY) small plugin to do this.
Download from here: http://www.myelin.co.nz/post/2006/2/24/#200602241
Install and activate the plugin, and from then on your archives should appear in ascending order.
Thread Starter
miaow
(@miaow)
Myelin – you are a champion. Thank you so much for this, it’s the only thing that I’ve found that actually does what it says it will. I am (obviously) not very PHP savvy, which is probably my main problem, but it’s such a simple thing, and it’s taken waaaaaay too long to find a solution. Thanks again!