Menu disappeared in custom post archive page

Posted in: Newspaper
Post count: 22

Hi

I created a custom post type and use categories. I added some lines to the functions.php in order for the categories to work for the custom post type (see below). Everything works, except the menu disappeared (https://staging2.wefrb.dk/category/restaurant).

Can you help?

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(‘wp_nav_menu’, ‘post’, ‘community’); // don’t forget nav_menu_item to allow menus to work!
$query->set(‘post_type’,$post_type);
return $query;
}
}

Post count: 23312

Hello Monokromdesign,

Unfortunately, please keep in mind that we cannot provide support for additional customizations, sorry! If you are not aware of the steps which are needed to take in this case, please consider hiring a freelancer/developer to help you. Usually, we recommend the developers from studio.envato.com.

Thanks for your understanding!

Post count: 22

Alright. Could you tell me what the main navigation is called? I tried with “wp_nav_menu” but it doesn’t work. Thanks.

Post count: 23312

Hello Monokromdesign,

Please notice that you’re going to hit several issues in this implementation, sorry! We have a useful guide for Custom Post type which can be found here -> https://forum.tagdiv.com/custom-post-type-support/ Download the plugin, check the code and try to customize as you wish.

Thanks for the message!

Viewing 4 posts - 1 through 4 (of 4 total)
The forum ‘Newspaper’ is closed to new topics and replies.