Kreativ Font - Kreativ Sound - Kreativ Theme

Codex: 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_page_menu(), by default);
otherwise nothing.

Usage

<?php wp_nav_menu( $args ); ?>

Parameters
$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

$menu
(string) (optional) The menu that is desired;
accepts (matching in order) id, slug, name

$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

$container_class
(string) (optional) the class that is applied to the container

$container_id
(string) (optional) The ID that is applied to the container

$menu_class
(string) (optional) CSS class to use for the containing
div element which forms the default menu,
or the ul element when a custom menu is
configured in the admin interface

$menu_id
(string) (optional) The ID that is applied to the ul element which forms the menu

$echo
(boolean) (optional) Whether to echo the menu or return it.
For returning menu use ’0′

$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.

$before
(string) (optional) Output text before the of the link

$after
(string) (optional) Output text after the
of the link

$link_before
(string) (optional) Output text before the link text

$link_after
(string) (optional) Output text after the link text

$items_wrap
(string) (optional) Whatever to wrap the items with an ul,
and how to wrap them with

$depth
(integer) (optional) how many levels of the hierarchy
are to be included where 0 means all

$walker
(object) (optional) Custom walker object to use
(Note: You must pass an actual object to use, not a string)
Return values
None.

Examples
Adding a Word at the Beginning of the Menu
This example will allow you to add the word of your choice to the beginning of your menu as a list item.
In this example, the word “Menu:” is added at the beginning.
You may want to set an id on the list item (“item-id” in this example) so that you can use CSS to style it.

<?php
wp_nav_menu(array('theme_location' => 'primary',
'items_wrap' => '<ul><li id="item-id">Menu: </li>%3$s</ul>')); 
?>

More informations

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

Leave a comment

or Subscribe to this comment feed via RSS