WordPress.org

Ready to get started?Download WordPress

Forums

Why are classes different for custom menu? (3 posts)

  1. darrcass
    Member
    Posted 1 year ago #

    The default wp_nav_menu(), using no custom menu, does this:
    <ul><li><a>...</a><ul class="children"><li><a>...</a></li></ul></li></ul>

    ...but a custom menu uses a different class for the nested list...
    <ul><li><a>...</a><ul class="sub-menu"><li><a>...</a></li></ul></li></ul>

    Why? Is there some "gotcha" reason involved? It doesn't make any sense to me.

  2. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    If someone used a secondary custom menu on a site, having the same class would potentially be quite problematic.

  3. darrcass
    Member
    Posted 1 year ago #

    Not if the secondary menu has a different id.

Topic Closed

This topic has been closed to new replies.

About this Topic