What is a WordPress Menus
Basically all in built and custom created WordPress widget you can see under wordpress admin dashboard > Appearance (Left sidebar) > Menus option resided. See below attached screenshot.
How to create custom header/navigation menus?
- Add menus register code into function file
- Go to Appearance (Left sidebar) > Menus create ‘Menu Name’ with same mantioned ‘id’ while register
- Get / display created menus into header/footer side
1. Add menus register code into function file
function wpb_custom_new_menu() {
register_nav_menu('header_menus',__( 'Header menus' ));
}
add_action( 'init', 'wpb_custom_new_menu' );
2. Go to Appearance (Left sidebar) > Menus create ‘Menu Name’ with same mantioned ‘id’ while register
3. Get / display created menus into header / footer side
wp_nav_menu( array( 'theme_location' => 'header_menus', 'container_class' => 'custom-menu-class' ) );