HTML to WP - Nav bar HTML Question

Hello,
In the past, I have developed some BootStrap to WP job and I have done the navigation part using BootStrap walker class.

This time, I using a custom navigation.

My question is… consider these 2 cases.
Case 1:
The HTML is real neat and clean…

 <nav>
     <ul>
     <li><a></a></li>
     <li><a></a>
       <ul>
        <li><a></a></li>
        </ul>
     </li>
     </ul>
 </nav>

Case2: The HTML is really dirty.

<nav class="menu">
<ul class="menu__list">
<li class="menu__item"><a href="#" class="menu__link">Home</a></li>
<li class="menu__item"><a href="#" class="menu__link">Gallery</a></li>
<li class="menu__item"><a href="#" class="menu__link">Portfolio</a></li>
<li class="menu__item"><a href="#" class="menu__link">Clients</a></li>
<li class="menu__item"><a href="#" class="menu__link">Contact</a></li>
<li class="menu__line"></li>
</ul>
</nav>

Now the Question is that can the 2nd nav be easily converted to WP?

Thank you… Sorry for a silly Question

Actually it’s not a silly question. The wp_nav_menu function that you use to display a custom menu has a list of parameters that you can use to customize the menu, including the menu_class, menu_id, container, container_class and container_id.

If you check-out the function’s reference page at wordpress.org, https://developer.wordpress.org/reference/functions/wp_nav_menu/, you will also see a list of the class names that are added by default which you could use.

1 Like

Thank you :slight_smile: Solved.

You’re very lucky if that is your idea of dirty html.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.