I am using the nav_menu walker class for my drop-down menu. I’ve designed it so it doesn’t need to use any classes or ids, except those specified by the user when they create their menu. How can I remove the extraneous class names and ids from my menu? (they don’t actually do any harm, but it’s ugly markup).
I thought I would extend the Walker class and remove the parts of the function that write the classes, but I don’t know how. My problem is I need to keep the user specified classes.
Here is a function that has the class stuff in it. Can someone help me remove the wordpress generated classes and ids?
Since your code was removed by a moderator, please post your code to a pastebin, and share the link here. It would also be helpful to give a pure HTML example of what you’re currently getting compared to the end result you want to achieve.
Thanks for looking at this.
Your nav html have different color for each navigation tab?
You use the WP-admin-> Appearance->Menus to create your menu?
If yes, I remember there is a CSS CLASSES for every menu, you could go to WP-admin-> Appearance->Menus ,
notice there is a screen Options top right?
Click in check the CSS CLASSES,
then you could have a input box for every menu drop down element for “CSS CLASSES (OPTIONAL)”, then you could add the color class for each menu.
Such as class purple for About us
Hope it helps.
- The topic ‘remove classes from nav_menu items’ is closed to new replies.