Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #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

    #133270

    It’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..

    #133271

    Hi 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….

    #133272

    Haha – 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.

    #133273

    Ok, thank you very much :)

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘New features: Conditional menu items’ is closed to new replies.