Ticket #18650: 18650.9.patch
File 18650.9.patch, 2.1 KB (added by , 10 years ago) |
---|
-
src/wp-includes/default-widgets.php
285 285 } 286 286 287 287 if ( $d ) { 288 $dropdown_id = "{$this->id_base}-dropdown-{$this->number}"; 288 289 ?> 289 <select name="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'> 290 <label class="screen-reader-text" for="<?php echo esc_attr( $dropdown_id ); ?>"><?php echo $title; ?></label> 291 <select id="<?php echo esc_attr( $dropdown_id ); ?>" 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. … … 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( 582 'orderby' => 'name', 583 'show_count' => $c, 584 'hierarchical' => $h 585 ); 580 586 581 587 if ( $d ) { 582 $cat_args['show_option_none'] = __('Select Category');588 static $first_dropdown = true; 583 589 590 $dropdown_id = ( $first_dropdown ) ? 'cat' : "{$this->id_base}-dropdown-{$this->number}"; 591 $first_dropdown = false; 592 593 echo '<label class="screen-reader-text" for="' . esc_attr( $dropdown_id ) . '">' . $title . '</label>'; 594 595 $cat_args['show_option_none'] = __( 'Select Category' ); 596 $cat_args['id'] = $dropdown_id; 597 584 598 /** 585 599 * Filter the arguments for the Categories widget drop-down. 586 600 * … … 595 608 596 609 <script type='text/javascript'> 597 610 /* <![CDATA[ */ 598 var dropdown = document.getElementById("cat"); 611 (function() { 612 var dropdown = document.getElementById("<?php echo esc_js( $dropdown_id ); ?>"); 599 613 function onCatChange() { 600 614 if ( dropdown.options[dropdown.selectedIndex].value > 0 ) { 601 615 location.href = "<?php echo home_url(); ?>/?cat="+dropdown.options[dropdown.selectedIndex].value; … … 602 616 } 603 617 } 604 618 dropdown.onchange = onCatChange; 619 })(); 605 620 /* ]]> */ 606 621 </script> 607 622