Wordpress Ascending Archives

Ok - I’m posting this here so that I don’t forget how I did this again. It just took me about 2 hours to figure out what had changed.

If you notice my blog archives over to the right…when you click on one it takes you to the archive page for that month, and shows the oldest post first. The navigation links at the top and bottom then make sense “Next Entries” take you forward in time, previous entries take you back…and the individual posts are listed chronologically down the page, rather than in the main blog structure where to newest post is at the top, and them reverse chronological down the page. I like it much better this way. The stock way is totally retarded.

Anyhow…in the interests of remembering how to do this next time I upgrade I’ll outline the procedure, as I have to make a change to a core file that gets overwritten during upgrade.

First, you must have a permalink structure set up. I just took the default one, and after hassling with my .htaccess file for awhile, got it working.

Now my links to the archives are like this:

http://www.thetribalunderground.net/brightness/2005/04/

Instead of like this:

http://www.thetribalunderground.net/brightness/?m=200504

This is important as the old, non-permalink way will not allow the next step to work.

Then, I went in to ‘../wp-include/template-functions-general.php’ and edited the “get_archives_link” function, and added “?order=asc” just after the ‘$url’ sections of each line, so that now the archive links all look like this:

http://www.thetribalunderground.net/brightness/2005/04/?order=asc

The only other thing you need to do is edit your archive template in your theme, and reverse the navigation links, as they will now do the opposite of what you expect. For instance, the “previous entries” link will now take you forward in time, rather than to a previous time.

Leave a Reply

Comment moderation is in use due to comment spam. If you submit your comment and it does not immediately appear, it has matched one or more of the criteria of comment spam. Unfortunately, these criteria are growing increasingly more strict, resulting in more false positives. However you can rest assured that if your comment is indeed not spam, it will be posted eventually. So please do not post twice.