Ticket #18650: 18650.diff
File 18650.diff, 4.1 KB (added by , 11 years ago) |
---|
-
wp-includes/default-widgets.php
244 244 $title = apply_filters('widget_title', empty($instance['title']) ? __('Archives') : $instance['title'], $instance, $this->id_base); 245 245 246 246 echo $before_widget; 247 if ( $title ) 248 echo $before_title . $title . $after_title; 247 if ( $title ) { 248 echo $before_title; 249 if ( $d ) { 250 echo '<label for="' . $this->id_base . '-dropdown-' . $this->number . '">' . $title . '</label>'; 251 } else { 252 echo $title; 253 } 254 echo $after_title; 255 } 249 256 250 257 if ( $d ) { 251 258 ?> 252 <select name="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'> <option value=""><?php echo esc_attr(__('Select Month')); ?></option> <?php wp_get_archives(apply_filters('widget_archives_dropdown_args', array('type' => 'monthly', 'format' => 'option', 'show_post_count' => $c))); ?> </select> 259 <select id="<?php echo $this->id_base . '-dropdown-' . $this->number; ?>" name="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'> 260 <option value=""><?php esc_attr_e( 'Select Month' ); ?></option> 261 <?php wp_get_archives( apply_filters( 'widget_archives_dropdown_args', array( 'type' => 'monthly', 'format' => 'option', 'show_post_count' => $c ) ) ); ?> 262 </select> 253 263 <?php 254 264 } else { 255 265 ?> … … 313 323 <ul> 314 324 <?php wp_register(); ?> 315 325 <li><?php wp_loginout(); ?></li> 316 <li><a href="<?php bloginfo('rss2_url'); ?>" title="<?php e cho esc_attr(__('Syndicate this site using RSS 2.0')); ?>"><?php _e('Entries <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>317 <li><a href="<?php bloginfo('comments_rss2_url'); ?>" title="<?php e cho esc_attr(__('The latest comments to all posts in RSS')); ?>"><?php _e('Comments <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>326 <li><a href="<?php bloginfo('rss2_url'); ?>" title="<?php esc_attr_e( 'Syndicate this site using RSS 2.0' ); ?>"><?php _e('Entries <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li> 327 <li><a href="<?php bloginfo('comments_rss2_url'); ?>" title="<?php esc_attr_e( 'The latest comments to all posts in RSS' ); ?>"><?php _e('Comments <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li> 318 328 <?php echo apply_filters( 'widget_meta_poweredby', sprintf( '<li><a href="%s" title="%s">%s</a></li>', 319 329 esc_url( __( 'https://wordpress.org/' ) ), 320 330 esc_attr__( 'Powered by WordPress, state-of-the-art semantic personal publishing platform.' ), … … 448 458 function widget( $args, $instance ) { 449 459 extract( $args ); 450 460 461 static $first; 462 $id = isset( $first ) ? 'cat' : $widget_id . '-select'; 463 $first = false; 464 451 465 $title = apply_filters('widget_title', empty( $instance['title'] ) ? __( 'Categories' ) : $instance['title'], $instance, $this->id_base); 452 466 $c = ! empty( $instance['count'] ) ? '1' : '0'; 453 467 $h = ! empty( $instance['hierarchical'] ) ? '1' : '0'; … … 454 468 $d = ! empty( $instance['dropdown'] ) ? '1' : '0'; 455 469 456 470 echo $before_widget; 457 if ( $title ) 458 echo $before_title . $title . $after_title; 471 if ( $title ) { 472 echo $before_title; 473 if ( $d ) { 474 echo '<label for="' . $id . '">' . $title . '</label>'; 475 } else { 476 echo $title; 477 } 478 echo $after_title; 479 } 459 480 460 481 $cat_args = array('orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h); 461 482 462 483 if ( $d ) { 463 484 $cat_args['show_option_none'] = __('Select Category'); 485 $cat_args['id'] = $id; 464 486 wp_dropdown_categories(apply_filters('widget_categories_dropdown_args', $cat_args)); 465 487 ?> 466 488 467 489 <script type='text/javascript'> 468 490 /* <![CDATA[ */ 469 var dropdown = document.getElementById("cat"); 491 (function() { 492 var dropdown = document.getElementById("<?php echo $id; ?>"); 470 493 function onCatChange() { 471 494 if ( dropdown.options[dropdown.selectedIndex].value > 0 ) { 472 495 location.href = "<?php echo home_url(); ?>/?cat="+dropdown.options[dropdown.selectedIndex].value; … … 473 496 } 474 497 } 475 498 dropdown.onchange = onCatChange; 499 })(); 476 500 /* ]]> */ 477 501 </script> 478 502