0

I am building a navigation with two menus. I have them registered:

  register_nav_menus([
      'contents_navigation' => __('Navegación contenidos', 'prr'),
      'insti-navigation' => __( 'Navegación institucional', 'prr' )
  ]);

And I have this code in the header template to output HTML:

wp_nav_menu([
    'theme_location' => 'insti_navigation', 
    'menu_class' => 'nav insti'
]);
wp_nav_menu([
    'theme_location' => 'contents_navigation',
    'menu_class' => 'nav cont'
]);

I think the output should be the same for both, but contents_navigation output ID in the UL and a lot of classes more than insti_navigation:

<div class="nav insti">
    <ul>
        <li class="page_item page-item-19">
            <a href="//localhost:3000/amigos/">Amigos</a>
        </li>
        <li class="page_item page-item-22">
            <a href="//localhost:3000/contacto/">Contacto</a>
        </li>
        <li class="page_item page-item-28">
            <a href="//localhost:3000/documentacion/">Documentación</a>
        </li>
        <li class="page_item page-item-26">
            <a href="//localhost:3000/iniciativas/">Iniciativas</a>
        </li>
        <li class="page_item page-item-8">
            <a href="//localhost:3000/introduccion/">Introducción</a>
        </li>
        <li class="page_item page-item-24">
            <a href="//localhost:3000/noticias/">Noticias</a>
        </li>
        <li class="page_item page-item-30">
            <a href="//localhost:3000/que-opinan/">Qué opinan</a>
        </li>
    </ul>
</div>

<div class="menu-navegacion-contenidos-container">
    <ul id="menu-navegacion-contenidos" class="nav cont">
        <li id="menu-item-40" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-40">
            <a href="//localhost:3000/que-opinan/">Qué opinan</a>
        </li>
        <li id="menu-item-41" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-41">
            <a href="//localhost:3000/documentacion/">Documentación</a>
        </li>
        <li id="menu-item-42" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-42">
            <a href="//localhost:3000/iniciativas/">Iniciativas</a>
        </li>
        <li id="menu-item-43" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-43">
            <a href="//localhost:3000/noticias/">Noticias</a>
        </li>
    </ul>
</div>

Why the markup is different between these two menus?

0

As can be seen in the code, there was a typo:

insti-navigation instead insti_navigation in the register function.

Sorry for the noise.

| improve this answer | |

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.