Welcome to the Treehouse Community
Looking to learn something new?
Thomas King15,197 Points
Does Automattic give a reason for not using <nav> in their WordPress Menus?
I'm currently working on developing my first intensive WordPress theme, and I noticed that despite the new semantic <nav> tags being introduced, WordPress does not use them when you include menus in your theme's template files.
Has the core team given any explanation as to why these changes have not yet been adopted?
Could it be because it has run for so long with the <div class="menu"> syntax, that they are afraid everything will break and cascade down to sites not up-to-date?
Colin Marshall32,861 Points
The presence of nav tags is dependent on the WordPress theme you are using, not on WordPress itself, however, WordPress does have a built-in function with an option to wrap a menu in nav tags.
The function wp_nav_menu will output an unordered list for a menu. This function has a $container option which can be set in the arguments if you want to wrap the unordered list in a set of tags. This option accepts either 'div' (default), 'nav', or false as a value.
I checked the last two official WordPress themes, Twenty Fifteen and Twenty Fourteen, and they both use nav tags. Those themes don't use the wp_nav_menu function to wrap their menus in nav tags, they just put the nav tags right in the template php. If you click the links for the themes above you will be taken to the theme file where the nav tags are present.
Does that clear it up for you at all? What themes are you looking at that do not use nav tags?