Documentation: UberMenu Conditionals

Knowledgebase Docs » UberMenu Conditionals

UberMenu Conditionals Knowledgebase 4

Welcome to UberMenu Conditionals Extension! Thank you for purchasing this plugin, I appreciate it! This guide should answer all your questions about how to use this plugin. You can browse the document using the navigation sidebar on the left, or search the entire document by using the search bar above.

View

Installation 0

Please note that as this plugin is an extension for UberMenu – WordPress Mega Menu Plugin, you must have that plugin installed in order for the Conditionals Extension to function Install the Plugin WordPress Plugin Uploader You can install UberMenu Conditionals Extension via the WordPress plugin uploader without unzipping the download package. Log into your WordPress admin panel Navigate to Plugins > Add New Click Upload Click Choose File and select the UberMenu Conditionals Extension download zip. Click Install Now. FTP You can also install UberMenu Conditionals Extension via FTP Extract the .zip file you downloaded from CodeCanyon. Find the ubermenu-icons folder (this directory is created when you unzip the file). Upload the ubermenu-icons folder to your wp-content/plugins directory. Navigate to your Admin Panel: Plugins Under UberMenu – Conditionals Extension, click Activate What did this do? Once you install the plugin, you’ll get: A new Conditionals Settings tab within the UberMenu menu item settings panel. Please see: Usage

View

Usage 0

UberMenu Conditionals allows you to optionally assign a condition to each menu item. If the condition is true, that menu item will be displayed; otherwise it will be removed from the menu.

View

Setting Conditions 5

To set a condition, navigate to Appearance > Menus, hover over the item you’d like to add a Condition to, and click the Uber button to open the Menu Item Settings Panel. Click the Conditionals tab on the left to show the Conditionals settings. Choose a condition under the Condition 1 setting. The settings are broken into categories: User Conditions – conditions based on the current user Page Conditions – conditions based on the current page Choose the condition that must be met for the item to be displayed. If we choose the On front page condition, it means this item will be displayed ONLY on the front page of the site. If we choose Not on front page, it means this item will be displayed on every page EXCEPT the front page. Parameters Some items have special parameters, such as page IDs or roles. If a condition has a parameter, it will be explained in the Condition’s description. Learn more about Conditional Parameters Multiple Conditions You can set up to two conditions, and determine whether one or both must be met. Learn more about multiple conditions

View

Condition Parameters 1

Some conditions can also accept parameters. For example, if you choose the On a page condition, the item will appear on any Page on your site. You can also provide it with a parameter – the page ID – to restrict this to a single page, identified by its ID. Setting a parameter If a condition can accept a parameter, that parameter will be explained in the Condition’s description: Above, you can see that the Front Page and Home Page conditions don’t accept any parameters. The On a Page condition accepts a parameter optionally, the Page ID. If you set the parameter to 15, the item will only appear on the Page with ID 15. To set the parameter, simply enter it in the parameter field Note that some Conditions require parameters, such as the On a post type Condition and most of the user conditions. Multiple string or integer parameters Some Conditions will accept multiple parameters. For example, with the On a page condition, you can provide a list of several pages, as a comma-delimited string. This string will be converted to an array when passed to the WordPress conditional function. The item would be displayed on Pages 15, 25, and 192

View

Examples 0

Display Menu Item only for admins Condition 1 – User is [role] Condition 1 Parameter – administrator Display Menu Item only for users who can manage options Condition 1 – If user can [capability] Condition 1 Parameter – manage_options Display Menu Item only on front page Condition 1 – On front page Condition 1 Parameter – N/A (empty) Display Menu Item only on Product Pages (custom post type: product) Condition 1 – On a Post Type [type] Condition 1 Parameter – product Display Menu Item for logged in users on Page 57 Condition 1 – If user is logged in Condition 1 Parameter – N/A (empty) Logical Operator – AND Condition 2 – On a page Condition 2 Parameter – 57

View

Multiple Conditions 0

UberMenu Conditionals allows you to set up to two conditions per menu item. Setting two conditions To set a second condition, use the Condition 2 and Condition 2 Parameter. They work just like the first condition. Choosing whether one or both conditions must be met Now that you have two settings selected, you’ll want to set whether EITHER or BOTH settings must be met in order for the item to be displayed. AND – if you select AND, both conditions must be met OR – if you select OR, either condition can be met Example Let’s say you’ve chosen two conditions: If user is logged in and On front page AND If you choose AND, the item will only be displayed on the front page when the user is logged in. If the user is logged in and on the front page, the item will be displayed. If the user is logged out and on the front page, the item will not be displayed. If the user is logged in and on the About page, the item will not be displayed. OR If you choose OR, the item will be displayed if the user is logged in OR if the user is on the front page. If the user is logged in and on the front page, the item will be displayed. If the user is logged out and on the front page, the item will be displayed. If the user is logged in and on the About page, the item will be displayed. If the user is logged out and on the About page, the item will not be displayed.

View

Dynamic URLs 0

Some items require URLs that are generated dynamically rather than set statically. UberMenu Conditionals will replace these special dynamic tags with the generated URL.

View

Logout Link 7

Adding a logout button to your menu requires a dynamic URL, as a nonce is required. UberMenu Conditionals allows you do do this by creating a Custom Menu Item and setting the URL to #umcdu-logout. Note that the dynamic URL will only be processed for UberMenu Items where a Condition has been set. Generally this would be coupled with the “If user is logged in” condition

View