Latest update


Enabling custom menus in WordPress theme

If you are running the new WordPress 3.0 or higher version, it supports the new custom menu app within the framework of WordPress itself.  However, not all themes inherently support these custom menu options as you will see under your “Appearance” >> “Menu” options link a disclaimer that says that your theme does not support custom menus if it isn’t included.  There is a workaround for this however where you can enable this feature in your theme to take full advantage of using this new 3.0 feature.
The first step is to modify your functions.php file included in your theme.  To do this, open up your functions.php file and add the following line of code:
add_theme_support( ‘menus’ )
The above piece of code is required for the option to be available in the admin appearance link.  After you have done this step, adding it to your functions.php file, you will need to add this to your theme itself.  Of note, is the fact that you don’t have to put this in the header.php file as it can reside in other locations as well.
<?php wp_nav_menu( array( ‘sort_column’ => ‘menu_order’, ‘container_class’ => ‘menu-header’ ) ); ?>
This piece of code will replace your original menu code that usually contains your wp_list_pages call.  Once you have these two things in place you can then go to your appearance admin section and create your custom menus without the nagging message that your theme doesn’t support the menus!

Post a Comment