Site logo

Archived topic

Tom's megamenu...

8 replies · Started by John on March 7, 2019

Viewing posts 1–9 of 9

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 ;)

Hi 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.

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?

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?

So you want to move the secondary navigation towards the bottom?

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.

The 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();
} );

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.

Ah 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?

This archived topic is closed to new replies.