diff --git src/wp-admin/css/customize-controls.css src/wp-admin/css/customize-controls.css
index b888f610bb..d7d538739d 100644
|
|
body.trashing #publish-settings { |
332 | 332 | margin-top: 10px; |
333 | 333 | } |
334 | 334 | |
335 | | .customize-control.customize-control-date_time .date-time-fields .date-input, |
336 | | .customize-control.customize-control-date_time .date-time-fields .date-time-separator { |
337 | | float: left; |
338 | | margin-right: 5px; |
339 | | } |
340 | 335 | .customize-control.customize-control-date_time .date-time-fields .date-input.day { |
341 | 336 | margin-right: 0; |
342 | 337 | } |
… |
… |
body.trashing #publish-settings { |
361 | 356 | margin: 0; |
362 | 357 | } |
363 | 358 | |
364 | | .date-time-fields .date-time-separator { |
365 | | line-height: 2; |
366 | | } |
367 | | |
368 | 359 | .date-time-fields .time-row { |
369 | 360 | margin-top: 12px; |
370 | 361 | } |
371 | 362 | |
372 | 363 | .date-time-fields .date-timezone { |
373 | | float: left; |
374 | 364 | line-height: 2.2; |
375 | 365 | text-decoration: none; |
376 | 366 | } |
… |
… |
body.adding-widget .add-new-widget:before, |
2830 | 2820 | width: 80px; |
2831 | 2821 | } |
2832 | 2822 | |
2833 | | .date-time-fields .date-time-separator, |
2834 | 2823 | .date-time-fields .date-timezone { |
2835 | 2824 | line-height: 3.2; |
2836 | 2825 | } |
diff --git src/wp-includes/customize/class-wp-customize-date-time-control.php src/wp-includes/customize/class-wp-customize-date-time-control.php
index d1e8d12500..9062c018f6 100644
|
|
class WP_Customize_Date_Time_Control extends WP_Customize_Control { |
98 | 98 | public function content_template() { |
99 | 99 | $data = array_merge( $this->json(), $this->get_month_choices() ); |
100 | 100 | $timezone_info = $this->get_timezone_info(); |
| 101 | |
| 102 | /* translators: 1: month, 2: day, 3: year, 4: hour, 5: minute */ |
| 103 | $format = sprintf( __( '%1$s %2$s, %3$s @ %4$s:%5$s' ), '__MONTH__', '__DAY__', '__YEAR__', '__HOUR__', '__MINUTE__' ); |
| 104 | |
| 105 | $date_format = get_option( 'date_format' ); |
| 106 | foreach ( array( 'Y', 'y', 'o' ) as $year_token ) { |
| 107 | $date_format = preg_replace( '/(?<!\\\\)' . $year_token . '/', '%1$s', $date_format ); |
| 108 | } |
| 109 | foreach ( array( 'F', 'm', 'M', 'n' ) as $month_token ) { |
| 110 | $date_format = preg_replace( '/(?<!\\\\)' . $month_token . '/', '%2$s', $date_format ); |
| 111 | } |
| 112 | foreach ( array( 'j', 'd' ) as $day_token ) { |
| 113 | $date_format = preg_replace( '/(?<!\\\\)' . $day_token . '/', '%3$s', $date_format ); |
| 114 | } |
101 | 115 | ?> |
102 | 116 | |
103 | 117 | <# _.defaults( data, <?php echo wp_json_encode( $data ); ?> ); #> |
… |
… |
class WP_Customize_Date_Time_Control extends WP_Customize_Control { |
116 | 130 | <fieldset class="day-row"> |
117 | 131 | <legend class="title-day {{ ! data.includeTime ? 'screen-reader-text' : '' }}"><?php esc_html_e( 'Date' ); ?></legend> |
118 | 132 | <div class="day-fields clear"> |
| 133 | <?php ob_start(); ?> |
119 | 134 | <label for="{{ idPrefix }}date-time-month" class="screen-reader-text"><?php esc_html_e( 'Month' ); ?></label> |
120 | 135 | <select id="{{ idPrefix }}date-time-month" class="date-input month" data-component="month"> |
121 | 136 | <# _.each( data.month_choices, function( choice ) { |
… |
… |
class WP_Customize_Date_Time_Control extends WP_Customize_Control { |
129 | 144 | </option> |
130 | 145 | <# } ); #> |
131 | 146 | </select> |
| 147 | <?php $month_field = trim( ob_get_clean() ); ?> |
| 148 | |
| 149 | <?php ob_start(); ?> |
132 | 150 | <label for="{{ idPrefix }}date-time-day" class="screen-reader-text"><?php esc_html_e( 'Day' ); ?></label> |
133 | 151 | <input id="{{ idPrefix }}date-time-day" type="number" size="2" autocomplete="off" class="date-input day" data-component="day" min="1" max="31" /> |
134 | | <span class="time-special-char date-time-separator">,</span> |
| 152 | <?php $day_field = trim( ob_get_clean() ); ?> |
| 153 | |
| 154 | <?php ob_start(); ?> |
135 | 155 | <label for="{{ idPrefix }}date-time-year" class="screen-reader-text"><?php esc_html_e( 'Year' ); ?></label> |
136 | 156 | <input id="{{ idPrefix }}date-time-year" type="number" size="4" autocomplete="off" class="date-input year" data-component="year" min="{{ data.minYear }}" max="{{ data.maxYear }}"> |
| 157 | <?php $year_field = trim( ob_get_clean() ); ?> |
| 158 | |
| 159 | <?php printf( $date_format, $year_field, $month_field, $day_field ); ?> |
137 | 160 | </div> |
138 | 161 | </fieldset> |
139 | 162 | <# if ( data.includeTime ) { #> |
… |
… |
class WP_Customize_Date_Time_Control extends WP_Customize_Control { |
144 | 167 | <# var maxHour = data.twelveHourFormat ? 12 : 23; #> |
145 | 168 | <# var minHour = data.twelveHourFormat ? 1 : 0; #> |
146 | 169 | <input id="{{ idPrefix }}date-time-hour" type="number" size="2" autocomplete="off" class="date-input hour" data-component="hour" min="{{ minHour }}" max="{{ maxHour }}"> |
147 | | <span class="time-special-char date-time-separator">:</span> |
| 170 | : |
148 | 171 | <label for="{{ idPrefix }}date-time-minute" class="screen-reader-text"><?php esc_html_e( 'Minute' ); ?></label> |
149 | 172 | <input id="{{ idPrefix }}date-time-minute" type="number" size="2" autocomplete="off" class="date-input minute" data-component="minute" min="0" max="59"> |
150 | 173 | <# if ( data.twelveHourFormat ) { #> |