Support » Themes and Templates » Disabling part of a menu drop down

  • Resolved Dustin1

    (@dustin1)


    Is there a way to disable a part of the drop down menu for members that are only signed in?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Moderator Andrew Nevins

    (@anevins)

    Forum moderator

    In which theme?

    esmi

    (@esmi)

    Forum Moderator

    I don’t think it’s possible to restrict part of a menu based on the user’s log in status (unless you got into creating your own walker for wp_nav_menu()). But you can create different custom menus in this kind of situation. See this thread.

    Esplanade is the teme Andrew

    I just had an idea… while not the most secure solution, it might work in some cases. You can define css classes in the menu, so if you were to give the menu the class of “admin”, then in the stylesheet have admin to display:none.

    However, when users are logged in, if you take a look at the body tag, it should have new css saying logged-in user (or something in that regard) on all the pages. In your css simply build a compound selector of .logged-in .admin {display: block} to display that menu item again.

    Moderator Andrew Nevins

    (@anevins)

    Forum moderator

    Using CSS to simply hide it will still allow non-members to access your webpages (that I assume you want hidden) through Google caching/ viewing the source code.

    @andrew, yes. It is a very crude solution. haha. You could also no-index those pages and it would stop google caching.

    It would be easy enough like esmi mentioned at the top just define a new menu if users are logged in, and to then include those pages.

    esmi

    (@esmi)

    Forum Moderator

    @andrew: I agree. It’s a really bad idea to try and use CSS in this way. Far better to have 2 menus – one for logged in users and one for the general public.

    *you would still want to no-index those other pages, or password protect them as google would pick them up and it would be as good of a solution as my css. lol.

    Next question is how to do you get it to activate when one logs in since our client is using the S2 Members extension for logging in/registering?

    Thank you for that.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Disabling part of a menu drop down’ is closed to new replies.