WP_Customize_Date_Time_Control::get_month_choices() WordPress Method

The WP_Customize_Date_Time_Control::get_month_choices() method is used to get the choices for the month field. The choices are stored as an array with the key being the month value and the value being the month label. The choices are based on the WP_Locale::$months array. The choices are translated using the __() function. The choices are sorted by the month value.

WP_Customize_Date_Time_Control::get_month_choices() #

Generate options for the month Select.


Description

Based on touch_time().

Top ↑

See also


Top ↑

Return

(array)


Top ↑

Source

File: wp-includes/customize/class-wp-customize-date-time-control.php

	public function get_month_choices() {
		global $wp_locale;
		$months = array();
		for ( $i = 1; $i < 13; $i++ ) {
			$month_text = $wp_locale->get_month_abbrev( $wp_locale->get_month( $i ) );

			/* translators: 1: Month number (01, 02, etc.), 2: Month abbreviation. */
			$months[ $i ]['text']  = sprintf( __( '%1$s-%2$s' ), $i, $month_text );
			$months[ $i ]['value'] = $i;
		}
		return array(
			'month_choices' => $months,
		);
	}


Top ↑

Changelog

Changelog
VersionDescription
4.9.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.