query_posts and custom taxonomy posts order

i have a custom taxonomy defined for “Projects” and a page that shows all the projects. In this page there’s a jquery filtering menu (isotope). Initially the page must show all the projects but chronologically (‘chronological’ is a category and 1970, 1980, 1990, etc are subcats for a Projects element) ordered in DESC mode.

Now the query that initially shows the Projects in the page is

Read More
query_posts('post_type=portfolio&project-type='.get_post_meta($post->ID, 'portfolio_page_cats', true).'&posts_per_page=-1&orderby=menu_order&order=ASC');

There are a lot of questions about this argument, i know. Please, what is the best way to do that?

Regards,

Related posts

Leave a Reply

1 comment

  1. If you are trying to order your posts by taxonomy terms, it’s not technically possible in one query (since multiple terms can belong to multiple posts – which means that WordPress cannot support ‘orderby’ for taxonomies or terms because there are potentially more than one).

    Your solution would be:

    1. Fetch a list of your (sub)terms and loop through them.
    2. In each term loop, run query_posts() to fetch only posts attached to the current term.
    3. In each term loop (after the query), create your content-output loop to display your posts.