Creating navigation bar troubles
-
Hello,
I want to fully understand how nav bars work in wp.
I had put in my function.php
<?php function register_my_menus() { register_nav_menus( array( 'header-menu' => __( 'Header Menu' ), 'nav-bar' => __( 'nav-bar' ), 'Menu1' => __( 'Menu1' ) // ,'extra-menu' => __( 'Extra Menu' ) ) ); } add_action( 'init', 'register_my_menus' ); ?>
To register my additional 2 menus. “nav-bar” and “Menu1”. I don’t know where does come from -> Header menu, if I dont have such menu name in my Menu in Appereance tab.
My code in header.php is:
<?php wp_nav_menu( array( 'menu_class' => 'menu', 'container_class' => '', 'menu' => 'nav-bar' ) ); ?>
1) I set containter_class to null and menu_class to ‘menu’ and I have div
class="menu-menu1-container"
name instead of my div class name ‘menu’ – why?
2) If I set in header.php any value to ‘menu’ it showing my Menu1 content – why?
3) If I set'theme_location' => 'header-menu'
in header.php I get content from ‘nav-bar’ and div name ‘menu’ – why? Where does it know which menu and this correct name?Thank you for sharing your help!
@@EDIT
To point 3) It showing all my sites, not only from nav-bar.
- The topic ‘Creating navigation bar troubles’ is closed to new replies.