Menu in category archive disappeared
-
Hi
I installed the plugin and all is good. Only problem is, that in the category archive page the main menu disappeared (https://staging2.wefrb.dk/category/restaurant).
I updated the functions.php with the code below … Hope you can help? The Theme is Newspaper8 …
Best regards from Lars
function my_cptui_add_post_types_to_archives( $query ) {
// We do not want unintended consequences.
if ( is_admin() || ! $query->is_main_query() ) {
return;
}if ( is_category() || is_tag() && empty( $query->query_vars[‘suppress_filters’] ) ) {
$cptui_post_types = cptui_get_post_type_slugs();$query->set(
‘post_type’,
array_merge(
array( ‘post’ ),
$cptui_post_types
)
);
}
}add_filter( ‘pre_get_posts’, ‘my_cptui_add_post_types_to_archives’ );
add_filter(‘pre_get_posts’, ‘query_post_type’);
function query_post_type($query) {
if( is_category() ) {
$post_type = get_query_var(‘post_type’);
if($post_type)
$post_type = $post_type;
else
$post_type = array(‘nav_menu_item’, ‘post’, ‘community’); // don’t forget nav_menu_item to allow menus to work!
$query->set(‘post_type’,$post_type);
return $query;
}
}The page I need help with: [log in to see the link]
- The topic ‘Menu in category archive disappeared’ is closed to new replies.