- This topic has 28 replies, 3 voices, and was last updated 3 years, 12 months ago by
David.
-
AuthorPosts
-
March 28, 2022 at 7:00 am #2169778
Loïc
Three months ago, I asked the drop down with the secondary menus. I want to know if it has become eventually possible.
Site is http://monstrous.com
I need to add items on drop down that will be visible on mobile
https://generatepress.com/forums/topic/drop-down-menu-5/
Thanks,
Loïc
March 28, 2022 at 7:59 am #2170018David
StaffCustomer SupportHi there,
there has been no change to the themes navigations during that time.
What you really require is a Third Navigation on your site, that supports drop down menus.You can try adding this PHP Snippet to your site:
add_action( 'init', function() { register_nav_menu('third-menu',__( 'Third Menu' )); } ); add_action( 'generate_before_header', function(){ ?> <nav id="third-navigation" class="secondary-navigation"> <div class="inside-navigation grid-container grid-parent"> <?php wp_nav_menu( array( 'theme_location' => 'third-menu', 'container' => 'div', 'container_class' => 'main-nav', 'menu_class' => '', ) ); ?> </div> </nav> <?php });It will do two things:
1. Create a new Menu Location in Appearance Menus – called
Third Menu
2. It will hook this Navigation in before the Site Header. And it will have the same styling as the Secondary Navigation. So you will want to use the Primary Nav in the Sidebar.Things to note:
It will not have a Mobile Version ie. with a Hamburger, and by default it will be hidden. Which we can provide some CSS to unhide it on mobile and to change its colors.March 29, 2022 at 3:26 pm #2171705Loïc
OK thanks I have the third menu shown up in appearance. Will kindly ask you for mobile navigation later since menus are pushed to the bottom of the page …
March 30, 2022 at 2:04 am #2172027David
StaffCustomer SupportJust to be clear.
For mobile, the third menu won’t have a mobile option.
The best option is to use the Off Canvas Panel for mobile – there you can construct a single combined menu.March 31, 2022 at 4:30 pm #2174084Loïc
Hello,
I wanted to have this menu with drop down in the top bar (as it is now). It seems that I can put only a widget here (no position in the menu customization) with no drop down. The menu below the header don’t look good …
March 31, 2022 at 6:57 pm #2174125Fernando Customer Support
Hi Loic,
To confirm, are you wanting to move the location of the third nav menu added to here?: https://share.getcloudapp.com/9ZumdB7K
If so, we can create a portable hook to do this.
Here are the steps:
1. Add this PHP:
function your_shortcode($atts, $content = null) { ob_start(); do_action('hook_name'); return ob_get_clean(); } add_shortcode('portable_hook', 'your_shortcode');2. Modify the previously added PHP provided by David to this:
add_action( 'init', function() { register_nav_menu('third-menu',__( 'Third Menu' )); } ); add_action( 'hook_name', function(){ ?> <nav id="third-navigation" class="secondary-navigation"> <div class="inside-navigation grid-container grid-parent"> <?php wp_nav_menu( array( 'theme_location' => 'third-menu', 'container' => 'div', 'container_class' => 'main-nav', 'menu_class' => '', ) ); ?> </div> </nav> <?php });3. Go to Appearance > Customize > Widgets > Top Bar, and add a Shortcode Block. Insert
[portable_hook]in the Shortcode Block.Here it is working on my end: https://share.getcloudapp.com/8LuDonBo
If it’s not appearing on Mobile or Table, you may need to add a CSS like this:
#third-navigation ul#menu-third-menu { display:flex; }Here is an article with regards to adding CSS: https://docs.generatepress.com/article/adding-css/#additional-css
Adding this through additional CSS should work.
Hope this clarifies. If you’re referring to something else, kindly let us know. 🙂
April 1, 2022 at 3:24 am #2174422Loïc
Look good … Thanks for the code. I will try to implement this and let you know. I am more looking for such out of the box functional features than esthetic bells and whistles in themes like GP. I hope that you can improve the menu system in next releases. Navigation is key to more page views and users.
April 3, 2022 at 5:20 pm #2176899Fernando Customer Support
You’re welcome Loic! Glad to be of assistance! Yes, you can do a lot of things with GeneratePress, you’ll just need out of the box ideas/custom solutions or codes to achieve some. Feel free to reach out anytime if you’ll need assistance with anything else. 🙂
April 7, 2022 at 2:58 am #2180801Loïc
Hello,
I did implement the changes on the staging site but I dont have much control on this third menu, I dont know how to customize it so it looks similar that on the page here … https://www.monstrous.com/
Please advise,
Loïc
April 7, 2022 at 3:08 am #2180806David
StaffCustomer SupportCan you provide a login to your staging site ?
April 7, 2022 at 5:00 am #2180870Loïc
yes sure. Seems that this third menu has same style as the secondary menu in the sidebar. Strangely, even hen clearing the cache the secondary menu don’t show up and third menu remains vertical …
April 7, 2022 at 5:17 am #2180888David
StaffCustomer SupportThat site URL requires a login
April 7, 2022 at 6:13 am #2180922Loïc
Thought I sent it previously
April 7, 2022 at 6:17 am #2180928David
StaffCustomer SupportIts not a WordPress login its a folder login:
April 7, 2022 at 6:29 am #2180939Loïc
It works this the login/password
-
AuthorPosts
- You must be logged in to reply to this topic.