- This topic has 11 replies, 3 voices, and was last updated 3 years, 5 months ago by
David.
-
AuthorPosts
-
October 17, 2022 at 2:28 pm #2376792
Marian
Hello,
I have Ultimate Member plugin which allows me to create a menu item with tags {first_name}{last_name}, so logged-in-user’s name is displayed. When it is in the primary menu it works fine together with two subitems.
However, I would like to have that one menu item on mobile displayed at all times. The other manu items can be in the burger menu.
I’ve tried using a secondary menu (…but I dont want to have primary and secondary menu stacked, and also secondary and primary nav together look messy on mobile)
I was thinking about “merging” primary and secondary navigation, so they are next to each other (not above/stacked) floating right, like this
LOGO PrimaryNav SecondaryNav
…but when I float both right they are stacked, don’t know whether such thing is even possible.
I tried creating Block element with navigation block in it, but to no avail. The tags are ignored.
Here are some pics to make it easier to understand what I want to achieve.
desktop current primary nav
Mobile viewI’ll be grateful for any pointers,
M.
October 17, 2022 at 5:42 pm #2376879Fernando Customer Support
Hi Marian,
What specific plugin is this? Do they have shortcode equivalent for tags or does adding curly brackets work – ex:
{{first_name}}?Can you reach out to them and ask if there’s a way to add those
template_tagsthrough the editor?October 17, 2022 at 10:27 pm #2377004Marian
Hello Fernando,
Thank you for your reply. The plugin is Ultimate Member. As it turns out there is a way how to display those values by means of a shortcode [first_name][last_name]. I put them into a block element and hooked as menu_bar_items. It works well – a logged-in-user name is displayed on both desktop and mobile as expected. I would however like to style it a bit (change color, padding) and most of all make it clickable and ideally have a dropdown menu with itmes. Is something like that possible to do with a shortcode?
Thanks,
M.October 18, 2022 at 1:57 am #2377164David
StaffCustomer SupportHi there,
you could use the Secondary Navigation.
Try:1. Create your menu for your secondary navigation.
2. Disable the Secondary Nav Mobile layout so it always shows the desktop:
https://docs.generatepress.com/article/disable-secondary-navigation-mobile-menu/
3. Remove the secondary nav from the theme by settings it location to: No Navigation.
https://docs.generatepress.com/article/secondary-navigation-location/4. Hook the Secondary nav back into the themes Menu Bar Items, so it shows aside of the primary menu on desktop and mobile with this PHP Snippet:
add_action( 'generate_menu_bar_items', function(){ ?> <div class="second-nav grid-container"> <?php if ( function_exists( 'generate_secondary_navigation_position' ) ) { generate_secondary_navigation_position(); } ?> </div> <?php });October 18, 2022 at 3:12 am #2377247Marian
What an amazing solution! It works almost as expected. Now I need to keep my secondary menu always displayed on mobile (now it’s just in a hamburger menu and its not clickable).
mobile view
I saw somewhere php to keep seconday always visble on mobile, so that might work.
Anyway. Thank you both so much for your kind help.
M.October 18, 2022 at 3:31 am #2377261David
StaffCustomer SupportDid you apply step 2?
2. Disable the Secondary Nav Mobile layout so it always shows the desktop:
https://docs.generatepress.com/article/disable-secondary-navigation-mobile-menu/
October 18, 2022 at 6:01 am #2377393Marian
Hello David,
I did indeed. I double-checked and found that both the snippet and CSS were where they should be.
Desktop is absolutely fine, exactly how I imagined it to be.
Desktop secondary nav in primary nav
However, in mobile view there are two hamburger buttons now, the right one (the remnant of the secondary nav I presume) is dead, unclickable)
Mobile view
If I tap the left mobile nav button, it works, I mean, it opens up, but the secondary nav seems to be nested in it and doesn’t function.
After clicking on the “primary” mobile navigation button
If I disable the last snippet, and also use “disable the secondary nav mobile layout so it always shows the desktop”, it works (but of course is not aligned with the primary).
I tried the process locally and, just to be sure, in my CSS editor I put just the css you provided and I disabled all unnecessary plugins. To no avail, though.October 18, 2022 at 6:26 am #2377409David
StaffCustomer SupportCan you disable Autoptimize so i can take a closer look ?
October 18, 2022 at 6:31 am #2377413Marian
Done.
October 18, 2022 at 6:54 am #2377445David
StaffCustomer SupportOk, try adding this CSS:
#secondary-navigation .secondary-menu-toggle { display: none !important; } #secondary-navigation ul { display: block !important; }October 18, 2022 at 6:58 am #2377454Marian
…that is exactly it. Speechless 🙂
Thank you.October 18, 2022 at 7:03 am #2377457David
StaffCustomer SupportHappy to be of help!!
-
AuthorPosts
- You must be logged in to reply to this topic.