I use Divi plugin.
I have these menu items:
- Blog
- Enterprise
- Coach
- Help
On my home page, I have these 4 items: OK When I click on "Entreprise" item (to show enterprise page), I want to hide automatically "Blog" item into toolbar menu. And of course if I come back on home page, I want to show "Blog" item.
How can I do that please?
I use Divi plugin.
I have these menu items:
- Blog
- Enterprise
- Coach
- Help
On my home page, I have these 4 items: OK When I click on "Entreprise" item (to show enterprise page), I want to hide automatically "Blog" item into toolbar menu. And of course if I come back on home page, I want to show "Blog" item.
How can I do that please?
Share Improve this question asked Jul 9, 2020 at 4:57 AnthonyAnthony 1011 Answer
Reset to default 1Add this code to your functions.php
:
function hide_menu_items( $items ) {
if ( is_page( 'Enterprise' ) ) { // You can use page ID, slug or title here
foreach ($items as $key => $item) if ( $item->title == "Blog" ) unset( $items[$key] );
}
return $items;
}
add_filter( 'wp_get_nav_menu_items', 'hide_menu_items', 20 );