[wp-trac] [WordPress Trac] #19297: Add new parameters to wp_nav_menu() and customize output this function

WordPress Trac wp-trac at lists.automattic.com
Sat Nov 19 11:20:08 UTC 2011


#19297: Add new parameters to wp_nav_menu() and customize output this function
-------------------------+-----------------------------
 Reporter:  egorpromo    |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Template     |    Version:  3.3
 Severity:  normal       |   Keywords:
-------------------------+-----------------------------
 In some cases menu that generated by wp_nav_menu() must have accurate
 class naming. Now I can see all sub-menus (<ul>) have the same class "sub-
 menu". And all li-items (<li>) have the same class "menu-item".
    I propose to use different names for all sub-menus depending of its
 level in depth. That can be made by add new options to wp_nav_menu()
 function to customise output by theme developers or simple create
 different classes for sub-menus in core of this function.

 Below I write example where all ul-tags have names depending of its level
 and all li-tags have names depending of its level:

 {{{
 <div class="menu-container">
 <ul class="menu">
    <li class="menu-item><a href="google.ru">google.com</a>
       <ul class="sub-menu">
          <li class="sub-menu-item"><a
 href="google.com/dir1">google.com/dir1</a></li>
       </ul>
    </li>
    <li class="menu-item"><a href="http://yahoo.com">yahoo.com</a>
       <ul class="sub-menu">
          <li class="sub-menu-item"><a
 href="yahoo.com/dir1">yahoo.com/dir1</a>
             <ul class="sub-sub-menu">
                <li class="sub-sub-menu-item"><a
 href="yahoo.com/dir1/dir2">yahoo.com/dir1/dir2</a></li>
             </ul>
          </li>
       </ul>
    </li>
 </ul>
 </div>
 }}}

 I suppose this option will help html developers to create simple,
 beautiful and cross browser Cascading Style Sheets (CSS) and create simple
 dropdown menus on Javascript.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19297>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list