I use this wordpress class to customize menu in BEM methodology. But I need to add to each first level menu item the class with consecutive numbers. For the first item it should be .main-nav__item_order_1
, for second .main-nav__item_order_2
and so on. Does anyone have any ideas how to do it?
How to add serial numbers to menu items in wordpress
140 views Asked by Evgeniy At
1
try this: https://gist.github.com/podlebar/6da77f557a207e4c675c
i changed code on line 6, 56 and 76
what i did: added a new variable counter.. apply it if menu element is first level.. if depth is 0 i increase the counter so on the next parent it will be one more.. without the check on line 76 it will increase with every element