I need to add custom attributes to single WordPress menu item.
<li id="menu-item-365" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-children-0">
<a href="http://www.mywebsite.com/whats-new/">WHATS NEW</a>
</li>
But I need this code like this
<li id="menu-item-365" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-children-0">
<a href="http://www.mywebsite.com/whats-new/" data-reveal-id="myModal1" data-animation="fade">WHATS NEW</a>
</li>
Can somebody please help?
Filter this, targetting a specific menu id is fairly easy:
Add the following to your
functions.php
file.Have you heard about Walker_Nav_Menu concept in WordPress?
here is an example, http://www.wpexplorer.com/adding-custom-attributes-to-wordpress-menus/
For WordPress functions.php
If you need to add attributes to more than one menu item:
Use jquery.