Add custom html to nav_menu

Im trying to add some html to the nav_menu. Basically I need a button tag inserted after the opening li tag if there are children in the menu. I see that there is a walker class but I have no idea on how to implement this. Any help would be appreciated thanks!!!

<ul class="menu-one">
            <li class="has-children">
           <button class="toggleExpand"><i class="fa fa-arrow-circle-right">    </i></button>
            <a href="https://wordpress.stackexchange.com/questions/168468/about-us.php">About Us</a>
                <ul class="sub-menu">
                    <li><a href="our-team.php">Our Team</a></li>
                    <li><a href="our-principles.php">Our Guiding Principles</a></li>
                </ul>
            </li><li class="has-children">
            <button class="toggleExpand"><i class="fa fa-arrow-circle-right"></i></button>
            <a>Our Fund</a>
                <ul class="sub-menu">
                    <li><a href="fund.php">Fund</a></li>

                 </ul>

            </li>
        </ul>

SOLVED>>>> I was able to add the button to the item_output variable. Basically I grabbed a walker class snippet and added the html to it.

$item_output .= '<button class="toggleExpand"><i class="fa fa-arrow-circle-right"></i></button><a'. $attributes .'>';

1 Answer
1

SOLVED>>>> I was able to add the button to the item_output variable. Basically I grabbed a walker class snippet and added the html to it.

$item_output .= '<button class="toggleExpand"><i class="fa fa-arrow-circle-right"></i></button><a'. $attributes .'>';

Leave a Comment