[wp-trac] [WordPress Trac] #20674: if menu classes are empty the empty attribute will be added to the <li> (solution inside)

WordPress Trac wp-trac at lists.automattic.com
Mon May 14 12:39:57 UTC 2012


#20674: if menu classes are empty the empty attribute will be added to the <li>
(solution inside)
-----------------------------+-----------------------------
 Reporter:  janw.oostendorp  |      Owner:
     Type:  enhancement      |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Menus            |    Version:  3.3.2
 Severity:  normal           |   Keywords:  has-patch
-----------------------------+-----------------------------
 I often remove the classes form the <li> in menu's with the filter
 'nav_menu_css_class'.
 That results in empty 'class="" ' attributes in my menu's.
 Fixing this is easy to do in the core:

 /wp-includes/nav-menu-template.php
 line 77

 {{{

 $class_names = ' class="' . esc_attr( $class_names ) . '"';
 }}}


 should be replaced with:

 {{{

 if (!empty($class_names )) {
     $class_names = ' class="' . esc_attr( $class_names ) . '"';
 }
 }}}

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


More information about the wp-trac mailing list