number(sample)

Display a number input field.

Option Details & Parameters

Type: number

Returns: string

Can be placed in: Admin Panels , Admin Tabs , Meta Boxes , Theme Customizer

Parameter Type Description
name string The name of the option, for display purposes only.
id string A unique ID for this option. This ID will be used to get the value for this option.
desc string The description to display together with this option.
default string (Optional) The default value for this option.
livepreview string (Optional) jQuery code that updates something in your site in the live preview. Only used when the option is placed in a theme customizer section. Refer to Livepreview for more information on this parameter.
css string (Optional) CSS rules to be used with this option. Only used when the option is placed in an admin page / panel or a theme customizer section. Refer to Generate CSS Automatically for your options for more information on this parameter.
placeholder string (Optional) The text to display inside the field when the field is empty
size string (Optional) The size of the width of the field. Value can be either medium or large. Defaults to medium
min number (Optional) The minimum value allowed. This can be an integer or a float. Defaults to 0
max number (Optional) The maximum value allowed. This can be an integer or a float. Defaults to 1000
step number (Optional) The minimal increment for the value. This can be an integer or a float. Defaults to 1
unit string Since v1.5.2
(Optional) An additional label, located immediately after the field. Accepts alphanumerics and symbols. Potential applications include indication of the measuring unit of the number.

Examples

Creating a number option:

$panel->createOption( array(
'name' => 'My Number Option',
'id' => 'my_number_option',
'type' => 'number',
'desc' => 'This is our option',
'default' => '10',
'max' => '100',
) );