I think this is a fairly simple issue but I haven't got my head around it.
Question: how do I get my custom posts to show only on the category archives, but not in the blog post listing page?
Background: I have a custom post type "video", with has_archive true and 'taxonomies' => array('category', 'post_tag') - I want to use standard categories with this custom post type.
I have successfully got my category pages to display by setting post_type and using the hook pre_get_posts as follows:
function my_query_post_type($query) {
if ( is_home() && false == $query->query_vars['suppress_filters'] )
$query->set( 'post_type', array( 'post', 'video', 'attachment' ) );
return $query;
}
add_filter('pre_get_posts', 'my_query_post_type');
If I don't use pre_get_posts, then my videos don't show - as expected.
However, now my blog post listing page shows the custom posts - as expected because I've changed the post_type in query.
Question: how do I get my custom posts to show only on the category archives, but not in the blog post listing page?
is_home()
will be false, no?