Home User profile
tagDiv Member
This user did not write anything. So we are just showing here some random text to make the profile page look nice :)
All Golfs
tagDiv Member

Hello,

Sorry, but I found where is the issue.
I add a function that was supposed to display my custom posts types everywhere on the website, but it is blocking the menu.
I put the function just after.

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

So when the function is on, the menu not display in categories, but when the code is of the categories not display (but menu ok).

I try to change :
$post_type; to $post_type = array(‘nav_menu_item’, ‘articles’, ‘post’, ‘golfs’, ‘categories’);
And it seems to work fine for now.

Do you think I have to add more things than ‘articles’, ‘post’, etc. ?

Thanks

All Golfs
tagDiv Member

Hello,

I have no cache or CDN for now and i try to disable all the plugins but no results. You can check the page where the menu is not working here : https://www.allgolfs.com/fr/golfs/france/

Thanks

Viewing 2 posts - 1 through 2 (of 2 total)