WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Disabling part of a menu drop down (11 posts)

  1. Dustin1
    Member
    Posted 1 year ago #

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

  2. Andrew
    Forum Moderator
    Posted 1 year ago #

    In which theme?

  3. esmi
    Forum Moderator
    Posted 1 year ago #

    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.

  4. Dustin1
    Member
    Posted 1 year ago #

    Esplanade is the teme Andrew

  5. Red Deer Web Design
    Member
    Posted 1 year ago #

    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.

  6. Andrew
    Forum Moderator
    Posted 1 year ago #

    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.

  7. Red Deer Web Design
    Member
    Posted 1 year ago #

    @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.

  8. esmi
    Forum Moderator
    Posted 1 year ago #

    @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.

  9. Red Deer Web Design
    Member
    Posted 1 year ago #

    *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.

  10. Dustin1
    Member
    Posted 1 year ago #

    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?

  11. Dustin1
    Member
    Posted 1 year ago #

    Thank you for that.

Topic Closed

This topic has been closed to new replies.

About this Topic