0
votes

I have setup a custom taxonomy called "video_categories" and have set it to two different custom post types - "videos" and "locations".

I am using the template "taxonomy-video_categories.php" to display the posts that have related taxonomys but I would only like to display the post type "videos" and exclude the post type "locations".

1
What did you try actually ? Show us your code.soju

1 Answers

0
votes

You can simply use query_posts to alter the main loop.

Put the following code before have_posts call :

global $query_string;
query_posts( $query_string . '&post_type=video' );

A proper way for doing this is to hook into pre_get_posts :

query_posts() is the easiest, but not preferred or most efficient, way to alter the default query that WordPress uses to display posts. Use query_posts() to display different posts than those that would normally show up at a specific URL. (The preferred way is hooking into 'pre_get_posts' and altering the main query that way using is_main_query)