WordPress.org

Ready to get started?Download WordPress

Forums

How To Add Custom Menu Classes Using Walker Function (5 posts)

  1. iversoncreative
    Member
    Posted 2 years ago #

    How would I utilize a Walker (http://codex.wordpress.org/Function_Reference/wp_nav_menu#How_to_add_a_parent_class_for_menu_item) to add a class to the sub menu? My menu code needs to look like this (stripped down to just what I need to add):

    <ul>
        <li class="dropdown"><a href="#">Parent Page</a>
            <ul class="dropdown-menu">
                <li><a href="#">Sub Page</a></li>
            </ul>
        </li>
    </ul>

    Any insights would be greatly appreciated!

    - Patrick

  2. David Choi
    Member
    Posted 2 years ago #

  3. iversoncreative
    Member
    Posted 2 years ago #

    Nope. Not quite. That only allows you to add a class to the <li> element, and not the parent <ul> element.

  4. David Choi
    Member
    Posted 2 years ago #

  5. iversoncreative
    Member
    Posted 2 years ago #

    No. I need to apply a tag to the child <ul> element. Neither of those achieves that.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags