mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
Only output the class attribute in wp_nav_menu() if we have classes to add. Don't waste time on an strlen() call. props niallkennedy, fixes #20483.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20513 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
1aa1918f28
commit
646ae32016
@ -74,10 +74,10 @@ class Walker_Nav_Menu extends Walker {
|
||||
$classes[] = 'menu-item-' . $item->ID;
|
||||
|
||||
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );
|
||||
$class_names = ' class="' . esc_attr( $class_names ) . '"';
|
||||
$class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
|
||||
|
||||
$id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );
|
||||
$id = strlen( $id ) ? ' id="' . esc_attr( $id ) . '"' : '';
|
||||
$id = $id ? ' id="' . esc_attr( $id ) . '"' : '';
|
||||
|
||||
$output .= $indent . '<li' . $id . $value . $class_names .'>';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user