Quick tips: Enable menu support for your themes in WP 3.0
Note: Updated with the latest way of doing nav menus, uses register_nav_menus instead of add_theme_support
You may be aware that a new major version of WordPress is coming out soon. Version 3.0 will bring some features like a new menu builder.
The menu builder will allow you to create a menu from any categories, pages and links, order them by drag and drop, create submenus, etc. If you are a WooTheme user you are already using this menu builder so you now what I am talking about.
Now to make you theme compatible with this new feature there are small step you need to take:
1 Tell WP your theme uses the menu builder
Add this simple line to your functions.php file
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => 'Primary Navigation'
) );Use the new function
Then Use the wp_nav_menu in your header:
<?php wp_nav_menu( 'sort_column=menu_order&container_class=menu-header' ); ?>And that’s it. I know it’s short but that’s why it’s called a quick tip :p
7 Comments
ARRRGH! Your solution was so simple! I couldn’t unwrap the div from my menus, but your implementation worded properly. You’ve completely exploded my brain. At least Now I can go to bed.
thank you for writing this up. everywhere ive gone to get help on this has given me some bull****, convoluted answer that leaves something out, or tells me to replace something they’ve written with something else, which they don’t explain! Thank you!
Works perfectly in WP 3.1.2.
Thanks!
This is exactly what I was looking for. Thanks a lot!
You ARE THE MAN!! :)
started thinking i got a bad installation
gr8 fast tip!
Thanks
Sagive
This is the quickest but yet the coolest and fater way to add custom menu support to your wordpress theme. I couldn’t believe in my eyes when I saw it working.
Thumbs up!
Thanks for the quick menu tip!