WordPress.org

Ready to get started?Download WordPress

Forums

wp_nav_menu custom walker class to add li-class for children (1 post)

  1. gerald@WPcustoms
    Member
    Posted 2 years ago #

    Hi everybody,

    I extended the wp-nav-menu walker class and need to get a custom class into the children list.
    I assume it must be coded into the start_el function starting at line 67:
    http://phpxref.ftwr.co.uk/wordpress/nav.html?wp-includes/nav-menu-template.php.source.html
    I copied it to my functions.php

    I managed to get the "topnav" added to the parent list but failed with the nested ul subnav list-class.
    it should look like this:

    <ul id="navigation">
    <li><a href="#">Home</a></li>
    <li class="topnav"><a href="#">Subs</a>
       <ul>
       <li class="subnav"><a href="#">Sub-Link 1</a></li>
       <li class="subnav"><a href="#">Sub-Link 2</a></li>
       </ul>
    </li>
    </ul>

    thanks for every help.

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 2 years ago by gerald@WPcustoms
  • This topic is not resolved
  • WordPress version: 3.3.1

Tags

No tags yet.