WordPress.org

Support

Support » How-To and Troubleshooting » WordPress add class to parent element if has submenu

WordPress add class to parent element if has submenu

  • I need to be able to add classes to a parent <li> as well as the child <ul> element in WordPress like so:

    <ul>
        <li>Top Level Page</li>
        <li class="NEED-NEW-CLASS-HERE">Top Level Page with Children
            <ul class="AND-HERE">
                <li>Child Page</li>
            </ul>
        </li>
    </ul>

    I can’t quite seem to grasp the whole walker thing, and do not want to do it via jquery. This seems common enough, but I can’t find a working answer anywhere. Has anyone here seen or done this? Any help and insight would be greatly appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WordPress add class to parent element if has submenu’ is closed to new replies.
Skip to toolbar