0

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

1

2 Answers 2

0

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', 
                                           array( 
                                                  'taxonomy' => 'mytaxonomyname', 
                                                  'field' => 'slug',
                                                  'terms' => array( 
                                                                    'myterm1slug',
                                                                    'myterm2slug' 
                                                                   ) 
                                                ) 
                                        ) 
                  ) 
);    
0

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!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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