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: https://develop.svn.wordpress.org/trunk@20513 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
22d478cc4c
commit
2aff808d88
@ -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