Menampilkan custom menu script ada sebagai berikut :
<?php wp_nav_menu( $args ); ?>
array 'menu' menggunakan slug dari menu yang sudah dibuat :
misal nama menu = Primary Menu
maka menu slugnya = primary_menu
<?php $defaults = array( 'theme_location' => '', '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" class="%2$s">%3$s</ul>', 'depth' => 0, 'walker' => '' ); wp_nav_menu( $defaults ); ?>
$theme_location
(string) (optional) The location in the theme to be used--must be registered with register_nav_menu() in order to be selectable by the user
Default: None
$menu
(string) (optional) The menu that is desired; accepts (matching in order) id, slug, name
Default: None
$container
(string) (optional) Whether to wrap the ul, and what to wrap it with. Allowed tags are div and nav. Use false for no container e.g. 'container' => false
Default: div
$container_class
(string) (optional) The class that is applied to the container
Default: menu-{menu slug}-container
$container_id
(string) (optional) The ID that is applied to the container
Default: None
$menu_class
(string) (optional) The class that is applied to the ul element which encloses the menu items. Multiple classes can be separated with spaces. Formerly known as $wrap_class.
Default: menu
$menu_id
(string) (optional) The ID that is applied to the ul element which encloses the menu items. Formerly known as $wrap_id.
Default: menu-{menu slug}; when there are duplicates, the next values are menu-{menu slug}-1, menu-{menu slug}-2, etc.
$echo
(boolean) (optional) Whether to echo the menu or return it. For returning menu use '0'
Default: true
$fallback_cb
(string) (optional) If the menu doesn't exist, the fallback function to use. Set to false for no fallback. Note: Passes $args to the custom function.
Default: wp_page_menu
$before
(string) (optional) Output text before the <a> of the link
Default: None
$after
(string) (optional) Output text after the </a> of the link
Default: None
$link_before
(string) (optional) Output text before the link text
Default: None
$link_after
(string) (optional) Output text after the link text
Default: None
$items_wrap
(string) (optional) Evaluated as the format string argument of a sprintf() expression. The format string incorporates the other parameters by numbered token. %1$s is expanded to the value of the 'menu_id' parameter, %2$s is expanded to the value of the 'menu_class' parameter, and %3$s is expanded to the value of the list items. If a numbered token is omitted from the format string, the related parameter is omitted from the menu markup. Note: To exclude the items wrap (for instance, if the wrap is built into your theme), you still need to pass %3$s as the parameter. If you pass an empty string, your menu won't display at all.
Default: <ul id="%1$s" class="%2$s">%3$s</ul>
$depth
(integer) (optional) How many levels of the hierarchy are to be included where 0 means all. -1 displays links at any depth and arranges them in a single, flat list.
Default: 0
$walker
(object) (optional) Custom walker object to use (Note: You must pass an actual object to use, not a string)
Default: new Walker_Nav_Menu