The 3 Week Diet

Create Conditional Menu in WordPress

By Sanjeev Shrivastava Our Bestseller: WordPress Themes

Have you ever imagined about conditional Menu? Imagine if you want to hide a particular menu from subscribers/authors/Editor/ etc. You can simply do this using a simple but effective plugin name “If-Menu”. Conditional menu comes in use if you really want to put restrictions on visibility of each individual Menu Items.

To download this plugin Click Here. Upload this plugin, install it and activate you are done in order to use the functionality of this plugin.

This plugin allows you to show/hide your Menu items based on some conditions. Whether it’s a single post, front page or simply a page you can put restrictions by enabling conditional logic. In order to use this plugin simply go to “Menu” tab under “Appearance” from your WordPress dashboard. Select your Menu and you will find each menu item has a “Enable Conditional Logic” check associated with it. Simply check that box and you can select the conditional statement from the drop down list.

In simple words you can understand working of this plugin with if-then statement.

“If(front page) then

Show(Contact US)”

OR

“If(User logged in) then

Hide(About US)”

This plugin also allows you to add your own custom “conditional statements”. Other conditional statement can be added by any other plugin or theme. Below is the code to add another 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’ ); } ); }

Conclusion:

This plugin is very useful in order to make user-friendly navigation menus by avoiding irrelevant menu items shown to him. Future releases of this plugin will have more functions.

About Sanjeev Shrivastava
author

Sanjeev loves web and his blog InfoTuts. His curiosity to know how things actually work keeps him active and inspires him to learn new things. He loves to help people. You can join him Here

Comments and Responses

Share on Google Plus

About Unknown

250 x 250 The 3 Week Diet tips skill football
    Blogger Comment
    Facebook Comment

0 nhận xét:

Đăng nhận xét