GeneratePress is very powerful and I love using the Elements to hook in and create templates for parts of my websites. Something I always felt limited by was creating nice headers in GeneratePress because of the menu.
I dug into the source code a little and managed to write a small snippet that allows you to output the GeneratePress navigation menu anywhere using a shortcode.
Demo
You can watch Kyle’s video on this for a step-by-step walkthrough on how you can use this on your website.
Snippet
Add the code below to functions.php
or code snippet plugin.
add_shortcode( 'gp_nav', 'tct_gp_nav' ); function tct_gp_nav( $atts ) { ob_start(); generate_navigation_position(); return ob_get_clean(); }
Copy
To Use:
Add the shortcode [gp_nav]
anywhere in your page or template to render the menu.