Archive: Custom post type and taxonomy
-
I’ve created a custom post type and a custom taxonomy, both called reference. The custom taxonomy is hierachical and I’ve created values (categories) like web, print etc. For each of the reference custom post type, I choose one of these custom taxonomy values.
These reference custom post types should be displayed on a archive on the URL references/. I’ve created a custom template (template-reference.php) and a page called reference using this template. I don’t know if this is the best way for creating a archive – please advice me, if I could do it different.
On the archive, the reference custom post types should be ordered first by the taxonomy and next the menu order. First showing all web references and next all print references.
In the template-reference.php file, my query looks like this:
$my_query = new WP_Query('post_type=reference&orderby=menu_order&order=ASC');
This will only sort the references by the menu_order – but I would like to group them in the different taxonomy, as explained before. How can I do that?
I’m wondering, if I first, in some way, could get a list of all the created taxonomies and then do the query for each taxonomies. But I don’t know how to do that.
I hope someone could help me. Please tell me, if you don’t understand the situation.
- The topic ‘Archive: Custom post type and taxonomy’ is closed to new replies.