WordPress.org

Ready to get started?Download WordPress

Plugin Directory

If Menu

Show/hide menu items with conditional statements

How can I add a conditinal statement

New conditional statements can be added by any other plugin or theme.

Example of adding a new conditional statement

add_filter( 'if_menu_conditions', 'my_new_menu_conditions' );

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

Requires: 3.0.0 or higher
Compatible up to: 3.4.2
Last Updated: 2012-10-10
Downloads: 8,154

Ratings

4 stars
4.9 out of 5 stars

Support

0 of 3 support threads in the last two months have been resolved.

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

0,1,0
100,1,1
100,1,1
100,1,1