This thread prompted me to post an updated to an old post on Wordpress Category Page Hacks as the old page was for wordpress 1.2, and I came up with a much simpler solution for wordpress 1.5. Below are instructions for customized sorting of Wordpress 1.5 category pages.
What I wanted to do, was to display my category pages in a single page format (ie: not 10 items per page), and to allow users the option to alternate between sorting by title (default) and date.
Previously I had hacked the php index page pretty badly, but this time around I use a simple category.php file, and a few small additions to my .htaccess file.
First in the .htaccss I modified the default category mapping line to sort by title, and show all the posts (or atleast 500 of them) on the same page
Next I added one more lines which allow two additional urls to select between sorting by title and sorting by date.
The Url's I wanted to use are in the following format
http://jehiah.com/archive/category/javascript/date/desc
http://jehiah.com/archive/category/javascript/title/asc
So the following .htaccess line takes the values for sort column and sort direction out of the url and passes them on to the rewrite.
4 years, 2 months ago
Cool.This seems like a nice solution.
Do you know whether it would be possible to do the same thing but order not by title but by a custom field value? (I know it’s an odd request, but I have a good reason…)
4 years, 2 months ago
Good one.
What if I have nested categories ?