How does wp_nav_menu work?
-
Hello,
I’m new to the WP community and I’m trying to build my first theme.
I’m having problems with the wp_nav_menu function.
I want to customize the markup that is generated by it but so far I’m failing. I want to change the container to <nav>, to set class=”” and id=”” to it.
in functions.php I’ve written:function register_menus() { register_nav_menus( array( 'header-menu' => __('Main Menu'), 'side-menu' => __('Side Menu'), 'footer-menu' => __('Footer Side Menu') ) ); }
in header.php:
wp_nav_menu(array('theme_location' => 'header-menu', 'container' => 'nav', 'menu_id' => 'mainNav', 'menu_class' => 'ulmenu', ));
The result is that only class=”ulmenu” is applied to the <div> tag containing
ul tag. What could possibly be the problem? I can change my CSS to make it work but I feel like if I don’t figure this problem out it will snowball in the future.Thanks in advance!
NikiOnTime
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘How does wp_nav_menu work?’ is closed to new replies.