[Resolved] 2 small problems, hide entire top menu & different homepage logged in/logged out

Home Forums Support [Resolved] 2 small problems, hide entire top menu & different homepage logged in/logged out

Home Forums Support 2 small problems, hide entire top menu & different homepage logged in/logged out

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #259702
    Anders

    Hi Tom,

    Problem #1.

    How do I hide the entire menu/top area including the sticky navigation when a user is not logged in, I have for nw disabled it in the page settings on that specific page that I am using as a home page right now.

    But I want it so that if the user logging in the navigation area would appear as normal with the navigation and sticky navigation.

    If I just use a plugin that controls the menu I would still see the navigation area without primary menu and I want to hide it all, any suggestions?

    Problem #2.

    This is almost related to the first problem.

    When a user is logged in, I need wordpress to show a different homepage, maybe could do some shortcode on the same page to show some different text instead of the text for logged out visitors, any smart suggestion? That does not show up in Google search with the logged in content?

    If any of you other users here at the forum have an idea how to do this, feel free to chip in .. =)
    .

    #259705
    Anders

    After some more research I found a solution on problem #2

    I am going to use the plugin “Hide This” by “Andrés Villarreal” in the WordPress plugin directory to solve the different homepage issue.

    So only one problem left then .. =)

    #259749
    Anders

    After some hours looking for a solution on problem #1 I think the best solution is to write a function that hides the area when not logged in, to bad I am not a php guru .. =)

    Anybody in this forum that could help me write a function snippet for this would be my hero for at least 2017 .. =)

    Would be nice to use that function with “Pluginception” to create a small theme specific plugin.

    Hope someone will share some love here .. Haha ..

    #259753
    Tom
    Lead Developer
    Lead Developer

    It would be pretty easy to hide those areas with CSS as WordPress adds the logged-in class to the body when you’re logged in.

    So you could do this:

    body:not(.logged-in) .site-header,
    body:not(.logged-in) .main-navigation {
        display: none;
    }

    Let me know if that works or not 🙂

    #260393
    Anders

    Hi Tom,

    Now you can title yourself a HERO for 2017, atleast my HERO .. =)

    I used part of the code, just for the navigation.

    body:not(.logged-in) .main-navigation {
        display: none;
    }

    Thanks a lot, handy little snippet .. Too bad the day is not 148 hours, so one could learn wordpress inside out .. but then, what would you be doing with all that free time .. =)
    .

    #260438
    Tom
    Lead Developer
    Lead Developer
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.