-
AuthorPosts
-
August 5, 2013 at 4:04 pm #27239
I have read this notice on ThemeForest:
with Enfold we went a step further and now allow you to display conditional menu items (based on user status like logged in or logged out, based on the page you are currently viewing etc)
This feature can be activated by adding the add_theme_support(‘avia_conditionals_for_mega_menu’); flag to the top of your functions.php file
This interests me very much!
But there are no explanations in documentation.
I put in my functions.php file the following code: add_theme_support(‘avia_conditionals_for_mega_menu’);
Please explain to me how you use this feature?
Many thanks
August 5, 2013 at 5:16 pm #133270It’s a new feature I worked on the last week. It helps you to show/hide a menu item if a certain condition is fulfilled. Kriesi and I think that the feature can confuse some of our users – especially if they’re wp beginners and not tech savvy and we decided to hide it a bit. To activate it add following code to functions.php – insert it at the very beginning of the file (after global $avia_config) or in your child theme functions.php
global $avia_config;
add_theme_support('avia_conditionals_for_mega_menu');Then go to Appearance > Menus and you’ll notice a new checkbox/option for each menu item. Tick it and you’ll see up to 4 additional option fields (depends on the dropdown selections)
The first dropdown allows you to select if you want to show or hide an item if the condition is fulfilled or you can also add a custom css class if the condition is fulfilled.
If you select the last option a new field will fade in which allows you to enter the css class(es).
The second dropdown allows you to select the conditional check (is user logged in, is user logged out, is user on a page, is user on a post page, etc.). Some conditionals (like is user on a page, is user on a post page) also allow you to filter the menu items based on an additional parameter (eg the post/page id). In this case another field will pop up where you can enter the additional parameter (i.e. the id of the post/page).
Overall I think I created a very powerful, extendable and logical ui which allows you to customize the menu quite easily – nevertheless you must wrap your mind around it and the new options definitely add some complexity to the theme/menu configuration..
August 5, 2013 at 5:54 pm #133271Hi Dude,
great, Amazing!
I tried a condition that I need:
Enable Conditional Logic: “Show” if “User is Author”
It works!
However there is an inconsistency.
Here’s an example: my site is http://www.mydomaintest.com – I want to hide the Shop page, visible only to users Author.
In Menu > Shop I select “Show” if “User is Author”, in this case the Menu Shop is not visible.
But if someone writes this URL: http://www.mydomaintest.com/shop sees the page Shop.
Is there a way to hide the Menu link and also the associated page? So that the menu links and the associated page is visible only to a class of type User.
Many Thanks
PS
Sorry for my bad English language….
August 5, 2013 at 5:59 pm #133272Haha – no sorry :) – this is really just a “conditional menu” feature and does not “protect” your content or restrict the access to certain pages/posts. You can try use a membership plugin like http://wp-member.com/ or S2Members to protect your content. Btw this is also no “inconsistency” because wordpress doesn’t protect pages which are not shown in your custom menu too.
August 5, 2013 at 6:20 pm #133273Ok, thank you very much :)
-
AuthorPosts
- The topic ‘New features: Conditional menu items’ is closed to new replies.