وردپرس نسخه 3,0+مرجع توابع مورد استفاده در کد نویسی پوسته
Navigation Menu Tags
WP Navigation Menu wp_nav_menu();
Displays a navigation menu created in the Appearance > Menus panel. Given a theme_location parameter, the function displays the menu assigned to that location, or nothing if no such location exists or no menu is assigned to it. If not given a theme_location` parameter, the function displays the menu matching the ID, slug, or name given by the menu parameter, if that menu has at least 1 item; otherwise, the first non-empty menu; otherwise, output of the function given by the fallback_cb parameter (wp_list_pages(), by default); otherwise nothing.
<?php wp_nav_menu($args); ?>
$args
Array
Default arguments:
<?php $defaults = array( | ||
'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' | => | , |
'depth' | => | 0, |
'walker' | => | , |
'theme_location' | => | |
); | ||
?> |
$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. 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) CSS class to use for the ul element which forms the menu. Default: menu
$menu_id
String
(Optional) The ID that is applied to the ul element which forms the menu. Default: menu slug, incremented
$echo
Boolean
(Optional) Whether to echo the menu or return it. Default: True.
$fallback_cb
String
(Optional) If the menu doesn't exists, the callback function to use. 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.
$depth
Integer
(Optional) How many levels of the hierarchy are to be included where 0 means all. 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
$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.