Menu shortcode

If you want to add a shortcode that inserts a WordPress menu at a specific position, you can use the following snippet:

function wpkb_menu_shortcode($atts, $content = null) {
    extract(shortcode_atts(array( 'name' => null, ), $atts));

    return wp_nav_menu( array( 'menu' => $name, 'echo' => false ) );
}

add_shortcode('menu', 'wpkb_menu_shortcode');

Now you can use the shortcode [menu name=“Name of my menu”] to insert the menu.