I have a nested dropdown. On elements that have children, I would like to add a chevron beside the link text. The current HTML looks like this:
<ul class="primary-menu">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-
children menu-item-59">
<a href="#">Europe</a>
<ul class="sub-menu"></ul>
</li>
</ul>
I would like to use an add_filter hook to turn this markup into this:
<ul class="primary-menu">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-
children menu-item-59">
<div>
<a href="#">Europe</a>
<img src="chevron.svg">
</div>
<ul class="sub-menu"></ul>
</li>
</ul>
I was hoping to find a filter that would return me an array of menu items. If the menu item has the class of 'menu-item-has-children' I would like to change the HTML within the item.