Input Controls

Controls for color pickers, code editors, date/time selectors, and background position.


WP_Customize_Color_Control

Color picker control supporting full color and hue-only modes.

Source: wp-includes/customize/class-wp-customize-color-control.php
Since: 3.4.0
Extends: WP_Customize_Control

Properties

PropertyTypeVisibilityDefaultSinceDescription
$typestringpublic'color'Control type
$statusesarraypublicStatuses array. Set to ['' => 'Default'] in constructor.
$modestringpublic'full'4.7.0Mode: 'full' for hex color picker, 'hue' for hue slider

Methods

MethodVisibilitySinceDescription
__construct( $manager, $id, $args )public3.4.0Initializes $statuses with default entry.
enqueue()public3.4.0Enqueues wp-color-picker script and style.
to_json()public3.4.0Exports statuses, defaultValue (from $this->setting->default), and mode.
render_content()public3.4.0No-op; rendered via JS.
content_template()public4.1.0JS template: hex input (maxlength="7") for full mode, number input (min="1" max="359") for hue mode.

WP_Customize_Code_Editor_Control

Code editor control using CodeMirror.

Source: wp-includes/customize/class-wp-customize-code-editor-control.php
Since: 4.9.0
Extends: WP_Customize_Control

Properties

PropertyTypeVisibilityDefaultSinceDescription
$typestringpublic'code_editor'4.9.0Control type
$code_typestringpublic''4.9.0Type of code being edited
$editor_settingsarray|falsepublicarray()4.9.0Code editor settings. See wp_enqueue_code_editor().

Methods

MethodVisibilitySinceDescription
enqueue()public4.9.0Calls wp_enqueue_code_editor() with $code_type and default indentUnit/tabSize of 2. Stores result in $editor_settings.
json()public4.9.0Returns parent JSON plus editor_settings and input_attrs.
render_content()public4.9.0No-op; rendered via JS.
content_template()public4.9.0JS template with label, description, notifications container, and textarea with class code.

WP_Customize_Date_Time_Control

Date and time picker control with configurable year range, time display, and 12/24 hour format.

Source: wp-includes/customize/class-wp-customize-date-time-control.php
Since: 4.9.0
Extends: WP_Customize_Control

Properties

PropertyTypeVisibilityDefaultSinceDescription
$typestringpublic'date_time'4.9.0Control type
$min_yearintpublic10004.9.0Minimum year
$max_yearintpublic99994.9.0Maximum year
$allow_past_dateboolpublictrue4.9.0Whether past dates are allowed
$include_timeboolpublictrue4.9.0Whether to show hours, minutes, meridian
$twelve_hour_formatboolpublictrue4.9.0Whether to use 12-hour format. Value still saved as Y-m-d H:i:s.

Methods

MethodVisibilitySinceDescription
render_content()public4.9.0No-op; rendered via JS.
json()public4.9.0Returns parent JSON plus maxYear, minYear, allowPastDate, twelveHourFormat, includeTime.
content_template()public4.9.0JS template with date fields (year, month select, day) arranged per site’s date_format option, optional time fields (hour, minute, meridian select), and timezone info. Falls back to ISO format if date_format lacks components.
get_month_choices()public4.9.0Returns array of month choices with text (number-abbreviation) and value. Based on touch_time().
get_timezone_info()public4.9.0Returns timezone info array with abbr and description (HTML). Uses timezone_string option or gmt_offset.
format_gmt_offset( $offset )public4.9.0Formats numeric offset to string with +/- prefix and :15/:30/:45 for fractional hours.

WP_Customize_Background_Position_Control

Control for selecting background image position via a 3×3 radio button grid.

Source: wp-includes/customize/class-wp-customize-background-position-control.php
Since: 4.7.0
Extends: WP_Customize_Control

Properties

PropertyTypeVisibilityDefaultSinceDescription
$typestringpublic'background_position'4.7.0Control type

Methods

MethodVisibilitySinceDescription
render_content()public4.7.0No-op; rendered via JS.
content_template()public4.7.0JS template with 3×3 grid of radio buttons for positions: left top, center top, right top, left center, center center, right center, left bottom, center bottom, right bottom. Uses dashicons for directional arrows.