Menu is a common element of every website. WordPress menu is a dynamic menu which is easy to use.
Inside your WordPress theme folder there is a file called function.php . Open this file and add this code in the bottom of the file-
[sourcecode]
<?php
function wptutsplus_register_theme_categorymenu() {
register_nav_menu( ‘categorymenu’, ‘Category Menu’ );
}
add_action( ‘init’, ‘wptutsplus_register_theme_categorymenu’ );
?>
[/sourcecode]
Then a custom menu is appears in the “Appearance > Menu > Manage Location”.And the name of the menu is ‘Category Menu’ . Set the menu here.
Then inside the header.php file add the following code below-
[sourcecode]
<?php
wp_nav_menu(
array(‘theme_location’ => ‘categorymenu’,
‘menu_class’ => ‘index-product’,
‘items_wrap’ => ‘<ul class="index-product-body">%3$s</ul>’,
) );
?>
[/sourcecode]
You can print the menu in anywhere of the theme file footer.php,page.php etc.
wp_nav_menu is a WordPress default function you can read details in here.