Custom post type posts don't show in archive widget
-
I have a custom post type called ‘Podcasts’ but none of the posts are showing in the archive widget. Only the main query (blog posts) are being shown.
I’ve tried adding this code below to include the Podcasts posts, but this only allowed them to show up in the archive template, which is great but not quite there yet.
/* Show Podcasts posts in archive */ add_filter('pre_get_posts', 'query_post_type'); function query_post_type($query) { if(is_category() || is_tag()) { $post_type = get_query_var('post_type'); if($post_type) $post_type = $post_type; else $post_type = array('nav_menu_item','post','podcasts'); $query->set('post_type',$post_type); return $query; } }
How can I get the Podcasts posts to show up in the archive widget?
For clarity, I’m talking about when I click the dropdown in the native archives widget. The days/months that should have podcast posts don’t even show up. Only the day/months for the blog posts show.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Custom post type posts don't show in archive widget’ is closed to new replies.