WordPress.org

Make WordPress Core

Changeset 20513


Ignore:
Timestamp:
04/18/12 19:06:22 (2 years ago)
Author:
nacin
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/nav-menu-template.php

    r19679 r20513  
    7575 
    7676        $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) ); 
    77         $class_names = ' class="' . esc_attr( $class_names ) . '"'; 
     77        $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; 
    7878 
    7979        $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args ); 
    80         $id = strlen( $id ) ? ' id="' . esc_attr( $id ) . '"' : ''; 
     80        $id = $id ? ' id="' . esc_attr( $id ) . '"' : ''; 
    8181 
    8282        $output .= $indent . '<li' . $id . $value . $class_names .'>'; 
Note: See TracChangeset for help on using the changeset viewer.