Archived topic
Hide Menu items
7 replies · Started by Rafael on August 1, 2022
Hi....
Is it possible to hide a menu item for not logged users without a plugins only using a CSS code??
Rafael
Hi there,
try:
1. Edit your menu and give the menu item you want to hide a CSS Class of hidden-on-logout.
See here for adding Class to menus:
https://docs.generatepress.com/article/using-the-wordpress-menu-builder/#custom-classes
2. Add this CSS:
body:not(.logged-in) .hidden-on-logout {
display: none !important;
}
Thanks David.....
But It's not working for me....I did as instructions........
I add the CSS code in the option adictional CSS, and insert in CSS Classes (optional) of the menu the cass hidden-on-logout......
Maybe is important that item I want to hide is in the secudary menu??
Can you share a link to the site ?
There is an error in your CSS it is missing a close }.
Can you add the bracket where i indicate in this image:
Thanks a lot David....its solved...Works great!!
Now I can hide the item I need...!!
Rafael
Glad to hear that !