WordPress.org

Ready to get started?Download WordPress

Ideas

CSS class "has-children" for menu items

  1. opatut
    Member

    12345

    I'd prefer a class 'has-children' on any <li> that has a <ul> subelement.

    Posted: 3 years ago #
  2. Lose-hair
    Member

    there is a body_class filter, if memory serves. That would be the right one to use.

    Posted: 2 years ago #
  3. Luke Mlsna
    Member

    12345

    I wrote a walker function that adds .main-menu .sub-menu .sub-sub-menu .menu-depth-# .menu-even/odd for the ul's and the same thing but -item instead of -menu for the li's. Made customizing the nav menu way easier.

    I could make it into a plugin if people really want it, but chances are if you care about the CSS in your menus, you can just add the function yourself.

    I wrote it up here: http://wikiduh.com/1541/custom-nav-menu-walker-function-to-add-classes

    Posted: 2 years ago #
  4. I'm not a technical guy, so a plugin will be real helpful...
    Let me know if you can do it

    Posted: 1 year ago #
  5. Luke Mlsna
    Member

    12345

    That ones a bit more complicated and you need some javascript. Save yourself the hastle and just download superfish for your menus.

    Posted: 1 year ago #
  6. drakemal
    Member

    I'm working on a new plugin (sb-menus) that will unify all
    main-menu .sub-menu .sub-sub-menu .menu-dept into one menu component that will be easy to use, very customizable, and with detailed documentation that hopefully will not be needed.

    Posted: 1 year ago #
  7. Ellen Hopkins
    Member

    Any word on a plugin for this yet?

    Posted: 7 months ago #
  8. GabrielD42
    Member

    The link to the custom walker class is broken. Can I get similar code elsewhere?

    Posted: 5 months ago #
  9. A plugin isn't needed for this, as there is now a class called menu-item-has-children which should do exactly the same.

    Posted: 5 months ago #
  10. dbrotherswp
    Member

    Are you sure about that? I'm trying to locate
    menu-item-has-children unsuccessfully. What version of WordPress is it?

    Posted: 4 months ago #

RSS feed for this topic

Reply »

You must log in to post.

  • Rating

    12345
    29 Votes
  • Status

    This idea has been implemented