Ticket #20810: wp_dropdown_categories_attr_opt.patch
File wp_dropdown_categories_attr_opt.patch, 1.2 KB (added by , 13 years ago) |
---|
-
category-template.php
307 307 'name' => 'cat', 'id' => '', 308 308 'class' => 'postform', 'depth' => 0, 309 309 'tab_index' => 0, 'taxonomy' => 'category', 310 'hide_if_empty' => false 310 'hide_if_empty' => false, 311 'attr' => array(), 311 312 ); 312 313 313 314 $defaults['selected'] = ( is_category() ) ? get_query_var( 'cat' ) : 0; … … 325 326 } 326 327 327 328 extract( $r ); 328 329 $tab_index_attribute = ''; 329 330 $attributes = ''; 331 foreach ( (array)$attr as $attr_name => $value ) { 332 $attributes .= " $attr_name=" . '"' . $value . '"'; 333 } 330 334 if ( (int) $tab_index > 0 ) 331 $ tab_index_attribute= " tabindex=\"$tab_index\"";332 335 $attributes .= " tabindex=\"$tab_index\""; 336 333 337 $categories = get_terms( $taxonomy, $r ); 334 338 $name = esc_attr( $name ); 335 339 $class = esc_attr( $class ); 336 340 $id = $id ? esc_attr( $id ) : $name; 337 341 338 342 if ( ! $r['hide_if_empty'] || ! empty($categories) ) 339 $output = "<select name='$name' id='$id' class='$class' $ tab_index_attribute>\n";343 $output = "<select name='$name' id='$id' class='$class' $attributes>\n"; 340 344 else 341 345 $output = ''; 342 346