Archived topic
Dropdown-Menu in topbar
11 replies · Started by Martin on April 6, 2021
If I include a dropdown menu in the topbar in a widget, the height of the topbar is adjusted to the dropdown.
However, the height should remain as it is and the menu items should open down.
How does it work?
Hi Martin,
Any chance you can link us to the site in question where the structure has been set?
You can use the private information field.
Let me know :)
Hi Ying,
in the top bar there are 4 widgets "phone number", "e-mail" and "contact form". Next to it the "Login".
I would now like to make a drowdown from the login like this:
Log in
- To register
- Change Password
- My account
Hi Martin,
It requires some coding to make a drop-down for top bar items.
I would recommend using secondary navigation instead which can be positioned at the top as well.
https://docs.generatepress.com/article/secondary-navigation-layout-overview/
Let me know :)
Hi Ying,
thank you for your prompt reply.
I had already thought about secondary navigation. But I can't integrate any icons there (or I don't know how).
What do you mean by "coding"? CSS only, or also Java / PHP?
What kind of icons are you referring to?
If they are SVGs then you can just add the SVG code in the menu label field.
Hi Leo,
I've tried it and it works. So I've almost reached my solution.
The only problem I have left is that I want to hide some menu items, depending on the user role.
How can I achieve this?
That's possible with CSS, could you give us some details?
Simple example:
xxxx (always)
yyyyy (always)
zzzz (only when user-roles = admin
Login (only if not logged in)
Logout (only if registered)
I don't think when you logged out there's any specific class.
But for the admin users, you could use this css class: body.admin-bar.
For the logged-in users, you could use this css class: body.logged-in.
Thanks
No problem :)