• Hi,

    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?

    [Code moderated as per the Forum Rules. Please use the pastebin]

Viewing 4 replies - 1 through 4 (of 4 total)
  • 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.

    Thread Starter kyleiwaniec

    (@kyleiwaniec)

    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.

    Thread Starter kyleiwaniec

    (@kyleiwaniec)

    what you’re describing is exactly what I’m doing. And my colors come up as one of the classes in the items.

    I want to remove the other generated classes.
    ie: menu-item menu-item-type-post_type menu-item-object-page.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘remove classes from nav_menu items’ is closed to new replies.