I am also trying to do the same thing: Sort posts alphabetically in a Category. This is easy to do in Movable Type, but I’m eager to replatform my site to WordPress and am in need of this functionality. Anyone out there with suggestions?
&sort=post_title&order=ASC’)
add that in to something for example:
<?php wp_get_archives(‘type=postbypost&sort=post_title&order=ASC’); ?>
lostinmysphereagain, thanks for the reply. That works in listing the titles of each post (as links), but it doesn’t actually display the full content of the post. Here is what I’m trying to do (as displayed through MT): http://www.asianmack.com/archives/cat_alternative.html
Here is the same version I’m trying to convert over to WordPress:
http://www.asianmack.com/wordpress/index.php?cat=2
As you can see, each post assigned in the particular Category in the MT version is displayed in alphabetical order by post title. I’m not versed in PHP, so I may be missing something obvious. Again, any tips would be appreciated.
ah i see. I don’t know in that case. sorry.
Thanks for your help regardless! Anyone else out there with any suggestions?
Ok, so for anyone that’s been folowing this post or is interested in sorting posts in alphabetical order rather than by date authored, I have made some headway.
Here’s my Category view sorted by default (Date authored):
http://www.asianmack.com/wordpress/index.php?cat=2
Here’s my Category view sorted the way I want it (Alphabetically):
http://www.asianmack.com/wordpress/index.php?cat=2&orderby=title&order=asc
Now the problem is, how do I get the links generated in wp_list_cats() to append that query string? Anyone out there have any ideas?
I finally figured this out. Anyone who wants to change the sort order of posts within a category listing should put the following code before The Loop.
<?php if (is_category()) { $posts = query_posts($query_string . ‘&orderby=title&order=asc’); } ?>
Thanks! That works great!
Wonderful! That does the trick in a very elegant fashion. Good work!
Could be that I’m having a dense moment but I am having the same issue and I can’t seem to be able to resolve it.
I need to be able to list all the posts on my wordpress blog in alphabetical order (regardless of the categories each post is in). Meaning, I need to devise a page or some place where visitors to my site can see a list of all the posts in the blog alphabetically, like an index.
Anyone with any helpful ideas on how to accomplish this? I am still a bit new to the php coding aspect of things so please be gentle with that. Thanks in advance!
I just would like to thank you Asianmack for the great bit of code. Was banging my head into the wall over this.
Thanks, that’s brilliant. I sent my self 500+ emails tracking the code through apply_filters(). I expected to find there was something in wp-settings or similar.
My version didn’t like just appending the string so I did a string replace. Phew. So happy to have it fixed.
thanks, thanks, thanks!
I’m just trying to create an alphabetical index of post titles, but for some reason when I get my list of posts they are in chronological rather than alphabetical order even though the lis was generated by this code:
<?php
wp_get_archives('type=postbypost&sort=post_title&order=ASC');
?>
Any thoughts?
I have distilled the bulk of this thread into a Codex contribution: Alphabetizing Posts.
How would you do this in the Smarty Templating engine?