- This topic has 8 replies, 3 voices, and was last updated 4 years ago by
Tom.
-
AuthorPosts
-
March 7, 2019 at 1:05 pm #832130
John
Did a quick search on the forum, and didn’t find my issue mentioned.
I just implemented Tom’s simple megmenu and shortcoded it. \
It shows up, so that’s a win. But not as described in the docs… it is a fully-displayed vertical ul/li, rather than the horizontal tab the docs show.
Help?
I’ll leave it up for a while at the link below 😉
GeneratePress 2.2.2GP Premium 1.7.8March 7, 2019 at 3:57 pm #832272Leo
StaffCustomer SupportHi there,
I’m not sure what you mean by shortcoded it?
The code should work if it’s applied in GP’s default primary or secondary navigation.
If you are referring to the menu at the bottom of the page you linked, it’s added with Thrive so that’s likely the problem.
Maybe check with their support to see if they have any recommendation for a mega menu.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 7, 2019 at 6:12 pm #832382John
Fair enough. Thrive allows inclusion of HTML as an element, but whatever.
I’ve moved the ‘short code’ to a non-thrive page: https://h2only.ca/basepage1/
The result: Exactly the same.PS: the ‘short code’ is generated by this code in functions.php:
/* Menu Shortcode */ function print_menu_shortcode($atts, $content = null) { extract(shortcode_atts(array( 'name' => null, ), $atts)); return wp_nav_menu( array( 'menu' => $name, 'echo' => false ) ); } add_shortcode('menu', 'print_menu_shortcode'); /* use shortcode [menu name="your-menu-name"] */ /* ---------------------------*/
Am I trying too hard? Is there an easier way?
March 7, 2019 at 6:16 pm #832386John
The code should work if it’s applied in GP’s default primary or secondary navigation.
Is it limited to that? And if so: can I use the ‘secondary nav’ option as a custom menu?
March 7, 2019 at 8:04 pm #832437Leo
StaffCustomer SupportSo you want to move the secondary navigation towards the bottom?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 8, 2019 at 5:11 am #832706John
Just to clarify: the Simple Megamenu only works within the confines of GP. Can it be hooked?
If so, I may have to rethink my process on this project a bit.
March 8, 2019 at 9:44 am #833125Tom
Lead DeveloperLead DeveloperThe code we provide only works with the structure of our menu. In your case, you’ve added the menu inside the content, so it’s missing the bulk of the necessary HTML to become the horizontal nav.
You could maybe try this:
add_shortcode( 'navigation', function() { ob_start(); if ( function_exists( 'generate_navigation_position' ) ) { generate_navigation_position(); } return ob_get_clean(); } );
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMarch 8, 2019 at 10:02 am #833145John
Woo-hoo! Thanks a bunch!
Made one small change to the above:
add_shortcode( 'navigation'
got changed to
add_shortcode( 'menu'
Gives me the top level as hoped for… but no second-level, nor does it allow drop down. Clues on that?
===
Oops. Spoke too soon. It renders the primary nav object, rather than my custom one.
March 8, 2019 at 5:07 pm #833382Tom
Lead DeveloperLead DeveloperAh yes, that code will render the primary navigation.
You would need some pretty considerable CSS to add mega menu functionality to a custom menu. Have you looked at any fo the available mega menu plugins?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-development -
AuthorPosts
- You must be logged in to reply to this topic.