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:
parent
eedb4857ba
commit
eff3b8925b
|
@ -287,8 +287,6 @@ class WP_Widget_Archives extends WP_Widget {
|
||||||
if ( $d ) {
|
if ( $d ) {
|
||||||
?>
|
?>
|
||||||
<select name="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'>
|
<select name="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'>
|
||||||
<option value=""><?php esc_attr_e( 'Select Month' ); ?></option>
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Filter the arguments for the Archives widget drop-down.
|
* 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.
|
* @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',
|
'type' => 'monthly',
|
||||||
'format' => 'option',
|
'format' => 'option',
|
||||||
'show_post_count' => $c
|
'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>
|
</select>
|
||||||
<?php
|
<?php
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @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.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue