How To: Add A Menu To Your WordPress Theme

Have you ever installed a new WordPress theme that didn’t have native support for creating and selecting custom menu (navigation bar). Now before you jump in be sure to either do a backup of your files, or as you get to the Functions.php and Header.php files copy the original code to a text editor before you modify it. Once you’ve done these preventative “CYA” measures follow these steps below:

From your Dashboard menu, go to Appearance > Edit and add the code below to the theme’s functions.php file: (in some cases I’ve seen this called “Theme Options” just above where it says “functions.php”. This is the same thing.)

You can add this code below towards the bottom of your page code so that you can easily find it later should you need to reference it.

add_theme_support( ‘menus’ );

(you may need to add this on the next line if you get to the end and your menu doesn’t show up:

add_action( ‘init’, ‘register_my_menus’ );

function register_my_menus() {
‘menu-1’ => __( ‘Menu 1’ ),

User your browser’s Find feature and search for this code in your theme’s Header.php file:

<?php wp_list_pages(‘title_li=&depth=1’); ?>

Highlight this string of code and replace it with this code below:

<?php wp_nav_menu( array( ‘sort_column’ => ‘menu_order’, ‘container_class’ => ‘menu-header’ ) ); ?>

Lastly click on Appearance then Menus and you should be able to create a custom menu.