How to Enable the WordPress Menu Built-In

By Fábio Zaffani How ToWordpress at 25 de January de 2012

WordPress implemented a feature for some versions now, the register_nav_menu function, with this method you can create as many menus as you want and handle through the admin panel, which, by the way, it’s a great feature and that was needed for quite a long time.

To use this function is very simple, open your functions.php file and insert this line of code

register_nav_menu(  'main', 'Main navigation menu');

Its worth mentioning that you can use as many menus as you please, on header ,footers, sidebars.. anywhere, you just need to register more menus, moar!

Now, pay attention to the name you are giving to your menu, you’re going to need to use it when you call it if you want to add more than one menu, if your template only uses one menu bar just call wp_nav_menu() and it should render accordingly.

If you want to render a specific type of menu, lets say the main from the example above, we would do the following:

wp_nav_menu(array(
'menu'            => 'main'
));

There are many more ways to control how your menu will be rendered, the layout and output of it through the $args the wp_nav_menu() function accepts.

You can find more information about which $args the wp_nav_menu() function accepts in the Function reference/wp_nav_menu at WordPress Codex.