- This topic has 8 replies, 3 voices, and was last updated 5 years, 1 month ago by Tom.
-
AuthorPosts
-
March 7, 2019 at 1:05 pm #832130John
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 😉
March 7, 2019 at 3:57 pm #832272LeoStaffCustomer 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.
March 7, 2019 at 6:12 pm #832382JohnFair 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 #832386JohnThe 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 #832437LeoStaffCustomer SupportSo you want to move the secondary navigation towards the bottom?
March 8, 2019 at 5:11 am #832706JohnJust 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 #833125TomLead 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(); } );
March 8, 2019 at 10:02 am #833145JohnWoo-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 #833382TomLead 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?
-
AuthorPosts
- You must be logged in to reply to this topic.