I'm trying to figure out if it's possible to attach an attribute to a wp nav menu item.
To demonstrate, this php:
<?php
wp_nav_menu(array(
'menu' => 'main',
'container' => false
));
?>
would output a menu like so:
<ul id="menu-main" class="menu">
<li id="menu-item-01" class="menu-item">Menu 01</li>
<li id="menu-item-02" class="menu-item">Menu 02</li>
<li id="menu-item-03" class="menu-item">Menu 03</li>
<li id="menu-item-04" class="menu-item">Menu 04</li>
</ul>
but what I'd actually like is something like this:
<ul id="menu-main" class="menu">
<li id="menu-item-01" class="menu-item" data-hook="01">Menu 01</li>
<li id="menu-item-02" class="menu-item" data-hook="02">Menu 02</li>
<li id="menu-item-03" class="menu-item" data-hook="03">Menu 03</li>
<li id="menu-item-04" class="menu-item" data-hook="04">Menu 04</li>
</ul>
Is that at all possible to achieve? The attribute doesn't have to be data-hook
I'm just using that as an example, just something I can use as an identifier.