How to add menu to WordPress Theme

The current theme does not natively support menus, but you can use the “Custom Menu” widget to add any menus you create here to the theme’s sidebar.

Some WordPress themes doesn’t natively support Menus which has been added in WordPress 3.

to solve this problem you have to add this code to your Theme functions.php file first

 

add_action( 'init', 'register_my_menus' );
function register_my_menus() {
register_nav_menus(
array(
'header' => __( 'Header Menu' ),
'footer' => __( 'Footer Menu )
)
);
}

the next step is to call the menu ,

place this code in your header.php file where you want the menu to appear

<?php wp_nav_menu( array( 'theme_location' => 'header' ) ); ?>

and the same goes for the footer menu, place this code in your footer.php file where you want the menu to appear

<?php wp_nav_menu( array( 'theme_location' => 'footer' ) ); ?>

after completing the steps, your theme will support WordPress Menus

fold-left fold-right
About the author
wptuts

3 Replies to How to add menu to WordPress Theme

  1. Sunny says:

    After adding the footer menu, how do you horrizontally centre the footer menu

  2. xing says:

    Very helpful.. thank you!

Leave a Reply