Make WordPress Core


Ignore:
Timestamp:
01/19/2015 08:25:36 AM (12 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/default-widgets.php

    r30982 r31241  
    288288?>
    289289                <select name="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'>
    290                         <option value=""><?php esc_attr_e( 'Select Month' ); ?></option>
    291 
    292290                        <?php
    293291                        /**
     
    300298                         * @param array $args An array of Archives widget drop-down arguments.
    301299                         */
    302                         wp_get_archives( apply_filters( 'widget_archives_dropdown_args', array(
     300                        $dropdown_args = apply_filters( 'widget_archives_dropdown_args', array(
    303301                                'type'            => 'monthly',
    304302                                'format'          => 'option',
    305303                                'show_post_count' => $c
    306                         ) ) );
    307 ?>
     304                        ) );
     305
     306                        switch ( $dropdown_args['type'] ) {
     307                                case 'yearly':
     308                                        $label = __( 'Select Year' );
     309                                        break;
     310                                case 'monthly':
     311                                        $label = __( 'Select Month' );
     312                                        break;
     313                                case 'daily':
     314                                        $label = __( 'Select Day' );
     315                                        break;
     316                                case 'weekly':
     317                                        $label = __( 'Select Week' );
     318                                        break;
     319                                default:
     320                                        $label = __( 'Select Post' );
     321                                        break;
     322                        }
     323                        ?>
     324
     325                        <option value=""><?php echo esc_attr( $label ); ?></option>
     326                        <?php wp_get_archives( $dropdown_args ); ?>
     327
    308328                </select>
    309329<?php
Note: See TracChangeset for help on using the changeset viewer.