If you are adding individual CSS styles to your menu items, you might want to automatically add the title of the menu item to its CSS classes. You can always do it manually like this, but adding it automatically can help prevent user error.
You could always style using the menu item’s “menu-item-ID” class, but I prefer to have a more descriptive class to work with.
Simply add this code to your theme’s functions.php file, and you will see a “menu-item-TITLE” class automatically added to each menu item.
https://gist.github.com/danbru1989/082b5f332f974ee3d565457b692cc81b
Leave a Reply