At the moment, I have this:
<nav><? wp_nav_menu(); ?></nav>
And it would be great to have it work like this:
<? wp_nav_menu(array("container" => "nav"); ?>
So the end result is very clean:
<nav>
<ul>
<li><a href="http://www.domain.com/page-a">Page A</a></li>
<li><a href="http://www.domain.com/page-b">Page B</a></li>
<li><a href="http://www.domain.com/page-c">Page C</a></li>
</ul>
</nav>
So it can remove the div wrapper and change it to a nav tag instead. I have done a lot of research and it seems as though it’s a known problem, whether the Codex isn’t written clearly or there really is a bug here. I’ve played around with register_nav_menu() and doing this doesn’t seem to change anything, as well as all the other answers on different forums. Why is this so hard to do for such a simple thing?
On another note, just because I like code to be very clean and easy to read, is there a way to include the correct spacing as shown above rather than it being in just one long line?
The
navvar isn’t working for me either. I would just use:'container' => falseinstead. This will at least get rid of the additional<div>tags within your added<nav>tags.'items_wrap'will allow you to clean up the output as well. More can be read about this argument here: https://wordpress.stackexchange.com/questions/19245/any-docs-for-wp-nav-menus-items-wrap-argument/19247#19247