I’ve read a few tutorials on how to add the functionality of the custom menus added in version 3.0 to my theme but they all seem to differ somewhat, and I’m not sure whether they contain superfluous code. In addition I read that the code to register your theme as menu-compatible changed between the RC and the public release.
What’s the simplest way of adding support for custom menus to my theme?
The easiest way is to use the
register_nav_menus
function.This should be hooked into'after_setup_theme'
:Then, in your theme, simply call that menu’s position:
Add this to
functions.php
of your theme. If you don’t have one, create it.:And this can go anywhere, I have it in
header.php
(seewp_nav_menu
() docs):This how to include the custom navigation in its simplest form, I believe it picks up the navigation with not identifier:
There are also basic options that can be passed to the function, here’s what I generally use: