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>

You 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.

| improve this answer | |
  • oh okay cause in a other stackquestion someone was telling the guy who was asking that container is only accepting div and yeah thats why i was so confused. – MisterLA Jan 22 '19 at 23:47
  • @MisterLA do you have link to that question maybe? – Krzysiek Dróżdż Jan 23 '19 at 6:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.