enable(sample)

Display an enable and disable toggle button.

Option Details & Parameters

Type: enable

Version: 1.8

Returns: boolean (If the toggle button is enabled it will return true otherwise false.)

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.
enabled string (Optional) The label for the button for the enabled state. Defaults to Enabled.
disabled string (Optional) The label for the button for the disabled state. Defaults to Disabled.
default boolean (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.

Examples

Creating an enable option:

$panel->createOption( array(
'name' => 'Enable Feature X',
'id' => 'is_enabled',
'type' => 'enable',
'default' => true,
'desc' => 'Enable or disable our X feature',
) );