WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I created a custom post type in my function.php of the theme and some a taxonomy for them. I added 2 categories in my taxonomy (first, second) and added some post in my new custom post.

I want to make a loop that will select from my custom posts only the ones in the first category (Taxonomy)

Or I want a archive that will display all my custom posts, but separated by the taxonomy like First category: one post, another post Second Category: this post, next post

share|improve this question
up vote 0 down vote accepted

Before the loop starts use query_posts. Available parameters are here. Something like this:

global $wp_query;
query_posts( array( 
                    'post_type' => 'mycustomname', 
                    'tax_query' => array( 
                                           'relation' => 'AND', 
                                                  'taxonomy' => 'mytaxonomyname', 
                                                  'field' => 'slug',
                                                  'terms' => array( 
share|improve this answer

I guess these will help you: http://codex.wordpress.org/Post_Types#Archive_template and Custom Taxonomy Displays Say you have a taxonomy named 'fiction'. Then your template will be taxonomy-fiction.php. In general, taxonomy-<taxonomy name>.php is the way to go!

share|improve this answer

Your Answer


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.