shortcode – wpv-menu

Sometimes it is useful to include a WordPress Menu in a Content Template or a View. It is possible to build a shortcode to display it:

// Display WP Menu shortcode 

add_shortcode('wpv-menu', 'print_menu_shortcode');
function print_menu_shortcode($atts, $content = null) {
  extract(shortcode_atts(array( 'name' => null, 'class' => null ), $atts));
  return wp_nav_menu( array( 'menu' => $name, 'menu_class' => $class, 'echo' => false ) );

wp_nav_menu() reference:

Then I can use this shortcode anywhere:

[wpv-menu name="main-menu"]

It is also possible to replace “main-menu” with any menu’s slug.

You can find this solution on this Toolset forum thread: