I'm thinking about wrapping the wp_nav_menu
with a nav tag instead of a div tag.
I've read at the WordPress codex that the container argument is only for using ul
or div
.
Do you guys know a way how to display the navigation in a nav tag so that the output looks like this:
<nav class="menu-header-menue-container">
<ul id="menu-header-menue" class="menu">
<li id="menu-item-86" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-86"><a href="home"></a></li>
</ul>
</nav>
I'm thinking about wrapping the wp_nav_menu
with a nav tag instead of a div tag.
I've read at the WordPress codex that the container argument is only for using ul
or div
.
Do you guys know a way how to display the navigation in a nav tag so that the output looks like this:
<nav class="menu-header-menue-container">
<ul id="menu-header-menue" class="menu">
<li id="menu-item-86" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-86"><a href="home"></a></li>
</ul>
</nav>
Share
Improve this question
edited Jan 22, 2019 at 21:34
Krzysiek Dróżdż
25.6k9 gold badges53 silver badges74 bronze badges
asked Jan 22, 2019 at 21:23
MisterLAMisterLA
257 bronze badges
1 Answer
Reset to default 2You were really close.
There is container
argument for wp_nav_menu
:
'container' (string) Whether to wrap the ul, and what to wrap it with. Default 'div'.
Its default value is 'div', which means, that the ul
will be wrapped with div
tag. You can change it to false
- ul
won't get wrapped at all in such case.
But you can also change it to nav
- and that is what you're looking.