Ticket #18650: 18650.6.patch
| File 18650.6.patch, 2.4 KB (added by , 11 years ago) |
|---|
-
wp-includes/default-widgets.php
285 285 } 286 286 287 287 if ( $d ) { 288 echo '<label class="screen-reader-text archives-label" for="' . $this->id_base . '-dropdown-' . $this->number . '">' . $title . '</label>'; 289 288 290 ?> 289 <select name="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'>291 <select id="<?php echo $this->id_base . '-dropdown-' . $this->number; ?>" name="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'> 290 292 <?php 291 293 /** 292 294 * Filter the arguments for the Archives widget drop-down. … … 322 324 } 323 325 ?> 324 326 325 <option value=""><?php e cho esc_attr( $label ); ?></option>327 <option value=""><?php esc_attr_e( $label ); ?></option> 326 328 <?php wp_get_archives( $dropdown_args ); ?> 327 329 328 330 </select> … … 563 565 } 564 566 565 567 public function widget( $args, $instance ) { 566 568 567 569 /** This filter is documented in wp-includes/default-widgets.php */ 568 570 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Categories' ) : $instance['title'], $instance, $this->id_base ); 569 571 … … 576 578 echo $args['before_title'] . $title . $args['after_title']; 577 579 } 578 580 579 $cat_args = array( 'orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h);581 $cat_args = array( 'orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h ); 580 582 581 583 if ( $d ) { 584 static $first; 585 $id = isset( $first ) ? 'cat' : $args['widget_id'] . '-select'; 586 $first = false; 587 588 echo '<label class="screen-reader-text categories-label" for="' . $id . '">' . $title . '</label>'; 582 589 $cat_args['show_option_none'] = __('Select Category'); 583 590 $cat_args['id'] = $id; 584 591 /** 585 592 * Filter the arguments for the Categories widget drop-down. 586 593 * … … 595 602 596 603 <script type='text/javascript'> 597 604 /* <![CDATA[ */ 598 var dropdown = document.getElementById("cat"); 605 (function() { 606 var dropdown = document.getElementById("<?php echo $id; ?>"); 599 607 function onCatChange() { 600 608 if ( dropdown.options[dropdown.selectedIndex].value > 0 ) { 601 609 location.href = "<?php echo home_url(); ?>/?cat="+dropdown.options[dropdown.selectedIndex].value; … … 602 610 } 603 611 } 604 612 dropdown.onchange = onCatChange; 613 })(); 605 614 /* ]]> */ 606 615 </script> 607 616