WordPress.org

Plugin Directory

If Menu

Display or hide menu items with conditions (user state, user roles, page type or custom ones)

If Menu is broken

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 the functionality for menu items.

How can I add a conditinal statement for menu items?

Custom conditions can be added easily by any plugins or themes.

Example of adding a new condition for disaplying/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_condition' );

function my_new_menu_condition( $conditions ) {
  $conditions[] = array(
    'name'    =>  'If single custom-post-type', // name of the condition
    'condition' =>  function($item) {          // callback - must return TRUE or FALSE
      return is_singular( 'my-custom-post-type' );
    }
  );

  return $conditions;
}

Where do I find conditional functions?

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

Who made that really cool icon

Got the icons from here https://dribbble.com/shots/1045549-Light-Switches-PSD, so giving the credit to Louie Mantia

Requires: 4 or higher
Compatible up to: 4.6.1
Last Updated: 4 weeks ago
Active Installs: 10,000+

Ratings

4.3 out of 5 stars

Support

5 of 9 support threads in the last two months have been marked resolved.

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
1 person says it's broken.

0,1,0
100,1,1
100,1,1
100,1,1
0,1,0
100,1,1
100,1,1
100,2,2
50,2,1
100,1,1
33,3,1 50,2,1
100,1,1
75,4,3
0,1,0
100,1,1 0,3,0
0,1,0