Display correct title in Archives widget if the type of archive was changed using the 'widget_archives_dropdown_args' filter.

props floriansimeth for initial patch.
fixes #31024.
Built from https://develop.svn.wordpress.org/trunk@31241


git-svn-id: http://core.svn.wordpress.org/trunk@31222 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2015-01-19 08:26:24 +00:00
parent eedb4857ba
commit eff3b8925b
2 changed files with 26 additions and 6 deletions

View File

@ -287,8 +287,6 @@ class WP_Widget_Archives extends WP_Widget {
if ( $d ) {
?>
<select name="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'>
<option value=""><?php esc_attr_e( 'Select Month' ); ?></option>
<?php
/**
* Filter the arguments for the Archives widget drop-down.
@ -299,12 +297,34 @@ class WP_Widget_Archives extends WP_Widget {
*
* @param array $args An array of Archives widget drop-down arguments.
*/
wp_get_archives( apply_filters( 'widget_archives_dropdown_args', array(
$dropdown_args = apply_filters( 'widget_archives_dropdown_args', array(
'type' => 'monthly',
'format' => 'option',
'show_post_count' => $c
) ) );
?>
) );
switch ( $dropdown_args['type'] ) {
case 'yearly':
$label = __( 'Select Year' );
break;
case 'monthly':
$label = __( 'Select Month' );
break;
case 'daily':
$label = __( 'Select Day' );
break;
case 'weekly':
$label = __( 'Select Week' );
break;
default:
$label = __( 'Select Post' );
break;
}
?>
<option value=""><?php echo esc_attr( $label ); ?></option>
<?php wp_get_archives( $dropdown_args ); ?>
</select>
<?php
} else {

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.2-alpha-31240';
$wp_version = '4.2-alpha-31241';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.