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

  1. someguy
    Posted July 24, 2011 at 3:44 pm | Permalink

    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.

  2. Noah
    Posted July 4, 2011 at 7:39 pm | Permalink

    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!

  3. Posted May 3, 2011 at 7:07 am | Permalink

    Works perfectly in WP 3.1.2.

    Thanks!

  4. Posted February 20, 2011 at 4:20 pm | Permalink

    This is exactly what I was looking for. Thanks a lot!

  5. Posted February 14, 2011 at 4:26 am | Permalink

    You ARE THE MAN!! :)

    started thinking i got a bad installation
    gr8 fast tip!

    Thanks
    Sagive

  6. Posted January 6, 2011 at 4:45 pm | Permalink

    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!

  7. Posted October 19, 2010 at 10:27 pm | Permalink

    Thanks for the quick menu tip!

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>