November 15, 2014 - Shortcodes

Places a navigation menu anywhere on a page.

You can specify a menu by it’s name or ID number:

[embed_menu]

[embed_menu menu="my_menu"]

[embed_menu menu=13]

ID number can be seen by going to

"Appearance" -> "Menus" -> "Select a menu to edit:" and check the /" dummy="menu=## in the address

[embed_menu] without specifying which one shows the default primary menu (*I think*)

Note that the embedded menu is wrapped in a div tag with a class "embed_menu"

PHP Code:

$defaults = array(
  'theme_location'  => '',
  'menu'            => "$menu",
  'container'       => 'div',
  'container_class' => '',
  'container_id'    => '',
  'menu_class'      => 'menu',
  'menu_id'         => '',
  'echo'            => true,
  'fallback_cb'     => 'wp_page_menu',
  'before'          => '',
  'after'           => '',
  'link_before'     => '',
  'link_after'      => '',
  'items_wrap'      => '<ul id="%1$s">%3$s</ul>',
  'depth'           => 0,
  'walker'          => ''
);
echo '<div class="embed_menu">';
wp_nav_menu( $defaults );
echo '</div>';

Ref:

http://codex.wordpress.org/Function_Reference/wp_nav_menu

Implemented in Shortcodes UI

Comments are closed.