Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have my own custom post type and it has its own taxonomy and terms.

Whenever user visits http://example.com/mytaxonomy/myterm I want the page to display all items within this term alphabetically.

I've created taxonomy-mytaxonomy.php file where I list the items using this loop:

while ( have_posts() ) : the_post(); 
    the_title(); 
endwhile; 

The question is - how to output these items in alphabetical order? query_posts() mixes these with regular posts.

share|improve this question

1 Answer

I was wrong, the answer below doesn't work.

global $query_string;
query_posts( $query_string . '&order=ASC' );

while ( have_posts() ) : the_post(); 
    the_title(); 
endwhile; 

http://codex.wordpress.org/Function_Reference/query_posts

share|improve this answer
2  
Won't this just change order while it's still by date? Also query_posts() is evil and should not be used. – Rarst Oct 9 '12 at 0:24
Rarst, my bad, you're right. I've been looking everywhere and sorting loop is always done with query_posts(). Any ideas how should I resolve this? – Wordpressor Oct 10 '12 at 20:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.