With the release of WordPress 3 the users can now activate the new custom menu feature which let’s you easily customize menus. Custom Navigation Menus feature in WordPress 3.0 will make WordPress even more user friendly for beginners. This function let you organize your menu, create drop down menus, add new items to menu, and much more. The drag-and-drop function of this feature is what makes it extremely easy to use. This feature will not be available in older themes unless the theme author(s) update their themes. In this article, we will show you how you can enable and install custom navigation menus in your themes.
To see if your theme has the new custom menus feature enabled, while in the Admin area, go to Appearence > Menus. If your current theme doesn’t support custom menus you’ll see this error message:

Now, to enable the feature for your theme go to functions.php file and enter the following code:
<?php
if ( function_exists( 'register_nav_menu' ) ) {
add_action( 'init', 'register_my_menu' );
function register_my_menu() {
register_nav_menu( 'primary-menu', __( 'Primary Menu' ) );
}
}
?>
The above code does the following:
To display the newly created menu enter the following code in the header.php file or where ever you want to display the menu
<?php
$args = array('theme_location' => 'primary-menu');
wp_nav_menu($args);
?>
Now your theme has the new custom menu feature enabled. To add/remove/modify the menu you can now login to WP-ADMIN and go to Appearence > Menus
If you want your menu to have a custom structure/class/id you can use the wp_nav_menu parameters. Bellow is a list with the parameters and their default values that the function accepts:
<?php
$args = array(
'theme_location' => ,
'menu' => ,
'container' => 'div',
'container_class' => 'menu-{menu slug}-container',
'container_id' => ,
'menu_class' => 'menu',
'menu_id' => ,
'echo' => true,
'fallback_cb' => 'wp_page_menu',
'before' => ,
'after' => ,
'link_before' => ,
'link_after' => ,
'items_wrap' => '
For a detailed list about each parameter check the WordPress Codex Page
Copyright © 2009-2011 Andrei Guzga