If Menu – Visibility control for Menu Items – WordPress plugin Free download

Click to Download

If Menu – Visibility control for Menu Items

Description

Control what menu items your site’s visitors see, based on visibility rules. Here are a few examples:

Display a menu item only if current User is logged in
Hide menu items if Device is mobile
Display menu items for Admins and Editors
Hide Login or Register links for Logged in Users
Display menu items for Users from US or UK
Display menu items only for Customers with active membership
Display menu items for visitors browsing with Language English or Spanish

The plugin is easy to use, each menu item will have a new option “Change menu item visibility” which will enable the selection of rules (example in Screenshots)

Features

Basic set of visibility rules

User state User is logged in
User roles Admin Editor Author etc
Page type Front page Single page Single post
Visitor device Is Mobile

Advanced visibility rules – requires Premium plan

Visitor location – detect visitor’s Country
Visitor language – detect visitor’s selected Language
WooCommerce Subscriptions – Display menus for users with active subscription
WooCommerce Memberships – Display menus for customers with active membership plans
Groups – Detect if users are in specific groups
WishList Member – Detect the users’ membership level
Restrict Content Pro – Detect the users’ subscription level

Multiple rules – mix multiple rules for a menu item visibility

show if User is logged in AND Device is mobile
show if User is Admin AND Is front page

Support for adding your custom rules

Example of adding a new visibility rule is described in the FAQ section

Screenshots

Enable visibility rules for Menu Items
Example of visibility rules

FAQ

If Menu is broken, no visibility rules are available

The code for modifying the menu items is limited and if other plugins/themes try to alter the menu items, this plugin will break.

This is an ongoing issue with WordPress which hopefully will be fixed in a future release.

Try to use just one plugin that changes functionality for menu items.

How can I add a custom visibility rule for menu items?

New rules can be added by any other plugin or theme.

Example of adding a new custom 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 rule
    'name'      =>  __('Single my-custom-post-type', 'i18n-domain'),    // name of the rule
    'condition' =>  function($item) {                                   // callback - must return Boolean
      return is_singular('my-custom-post-type');
    }
  );

  return $conditions;
}

Where can I find conditional functions?

WordPress provides a lot of functions which can be used to create custom rules for almost any combination that a theme/plugin developer can think of.

Reviews

Leave a Reply

Your email address will not be published. Required fields are marked *