[wp-trac] [WordPress Trac] #31024: Add a new hook to the first <option>-element of the archive widget dropdown

WordPress Trac noreply at wordpress.org
Thu Jan 15 10:46:03 UTC 2015


#31024: Add a new hook to the first <option>-element of the archive widget dropdown
-------------------------------------+-----------------------------
 Reporter:  floriansimeth            |      Owner:
     Type:  enhancement              |     Status:  new
 Priority:  normal                   |  Milestone:  Awaiting Review
Component:  Widgets                  |    Version:  4.1
 Severity:  normal                   |   Keywords:
  Focuses:  accessibility, template  |
-------------------------------------+-----------------------------
 Hey WP-Community,

 I would kindly ask if it's possible to integrate a new filter into the
 [[https://core.trac.wordpress.org/browser/tags/4.1/src/wp-includes
 /default-widgets.php#L290|default-widgets.php]].

 It should allow us to change the title of the first <option> element.

 The problem is that if I hook into the
 [[https://developer.wordpress.org/reference/hooks/widget_archives_dropdown_args/|widget_archives_dropdown_args]]
 and change the argument {{{type}}} from {{{monthly}}} to {{{yearly}}} the
 script would always output "Select Month" instead of "Select Year".

 Of course it's possible to hook into the {{{gettext}}} filter but I think
 this is not the ideal solution as translated texts could be used
 elsewhere, too.

 So what I mean is to change the following line:

 {{{<option value=""><?php esc_attr_e( 'Select Month' ); ?></option>}}}

 into something like this:

 {{{<option value=""><?php esc_attr_e( apply_filters(
 'widget_archives_dropdown_first', 'Select Month' ) ); ?></option>}}}

 Thanks

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31024>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list