Home › Forums › Support › 2 small problems, hide entire top menu & different homepage logged in/logged out
- This topic has 5 replies, 2 voices, and was last updated 7 years, 3 months ago by Tom.
-
AuthorPosts
-
January 1, 2017 at 3:28 pm #259702Anders
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 .. =)
.January 1, 2017 at 4:06 pm #259705AndersAfter 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 .. =)
January 1, 2017 at 6:32 pm #259749AndersAfter 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 ..
January 1, 2017 at 7:29 pm #259753TomLead DeveloperLead DeveloperIt 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 🙂
January 3, 2017 at 4:32 pm #260393AndersHi 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 .. =)
.January 3, 2017 at 7:10 pm #260438TomLead DeveloperLead DeveloperGlad I could help! 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.