If Menu is a WordPress plugin which adds extra functionality for menu items, making it easy to hide or display menu items based on user-defined rules. Example:
User is logged invisiting from mobile deviceAdmins and EditorsThe plugin is easy to use, each menu item will have a “Change menu item visibility” option which will enable the selection of rules.
This repo is used only for development, downloading & installing from here won't work as expected. Install from WordPress.org plugin page
User is logged inAdmin Editor Author etcFront page Single page Single postIs MobileIs RTLUser is logged in AND Device is mobileUser is Admin AND Is front pageCustom visibility rules can be added easily by any plugin or theme. Example of adding a new rule for displaying/hiding a menu item when current page is a custom-post-type.
// theme's functions.php or plugin file
add_filter('if_menu_conditions', 'my_new_menu_conditions');
function my_new_menu_conditions($conditions) {
$conditions[] = array(
'id' => 'single-my-custom-post-type', // unique ID for the condition
'name' => __('Single my-CPT', 'i18n-domain'), // name of the condition
'condition' => function($item) { // callback - must return Boolean
return is_singular('my-custom-post-type');
}
);
return $conditions;
}
Head over to plugin's page on WordPress.org for more info, reviews and support