I need help creating a custom WordPress menu. WordPress Adds its own classes that I don’t need. I need someone to help me solve this issue. WordPress doesn’t add some attributes when I need them on drop-down.
Here is my HTML code.
<nav class="navbar navbar-default navbar-static-top">
<div class="container-fluid container">
<div class="row m04m">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#main_nav">
<span class="bars">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</span>
<span class="btn-text">Select Page</span>
</button>
</div>
<div class="collapse navbar-collapse" id="main_nav">
<ul class="nav navbar-nav">
<li class="active "><a href="#">Home</a></li>
<li class=" dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">About</a>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Company Profile</a></li>
<li><a href="#">Board of directors</a></li>
<li><a href="#">Owner's message</a></li>
<li><a href="#">team</a></li>
</ul>
</li>
<li>
<a href="#">projects</a>
</li>
<li class=" dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Media</a>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Gallery</a></li>
<li><a href="#">documents</a></li>
</ul>
</li>
<li class=" dropdown">
<a href="#" class="dropdown-toggle" role="button" aria-expanded="false">news</a>
</li>
<li class=" dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">contact</a>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Conact us</a></li>
<li><a href="#">Careers</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</nav> <!--Main Nav-->
What you are looking for is the Walker class in WordPress. It’s built in and can help you create custom navigation amongst other things.
You can read more about it here: https://codex.wordpress.org/Class_Reference/Walker