Custom Post Types not showing in any widgets
-
Hello All,
I’m having issues getting custom post types to show up anywhere but the archives. I’m sure it is something to do with pre_get_posts but I’m not sure what to do. I have my current query below to get it working on the archive pages. My custom post types are ‘artists’ and ‘releases’. I’ve also tried adding $query->set(‘post_type’,array(‘artists’,’release’,’post’,’page’);
but then the archive pages don’t show correctly.function set_category_query($query) { if(!is_admin() && (is_category() || is_tag()) && $query->is_main_query()) { $post_type = get_query_var('post_type'); $query->set('orderby','title'); $query->set('order','ASC'); $query->set('posts_per_page',50); if ( is_category('groups') || is_category('bands') || is_category('dub_group') || is_category('vocal_duos') || is_category('vocal_groups') || is_category('individuals') || is_category('dub_engineers') || is_category('mixers') || is_category('musicians') || is_category('nonmusicians') || is_category('producers') || is_category('solo_artists')) { $query->set('post_type','artists'); } elseif ( is_category('releases') || is_category('masters') || is_category('versions') || is_category('albums') || is_category('eps') || is_category('singles') ) { $query->set('post_type','releases'); } if ($query->is_home()) { $query->set('post_type',array('artists','releases','post') ); } } return $query; } add_filter('pre_get_posts', 'set_category_query');
The page I need help with: [log in to see the link]
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Custom Post Types not showing in any widgets’ is closed to new replies.