Reputation: 47
I am trying to figure out if there is a way to have a conditional logic based upon the current nav_menu / menu id. For instance, I have multiple menus and I would like to have show or hide a specific div container based upon the menu that is shown.
So if any certain page, for instance, is using the menu with id 27 (nav-menus.php?action=edit&menu=27) then I would like to show a specific div container and hide it in case the specific page is using menu id 26.
Is this somehow possible? I've tried to make a little research on the subject but can't find anything in relation to it. Some expert help would be greatly appreciated, thank you.
Upvotes: 1
Views: 230
Reputation: 339
You can access menu variable and base your logic on it.
<?php
if($menu_item->ID == "27")
{
//Show div here
}
else
{
//Show something else here
}
?>
Upvotes: 1