-
Notifications
You must be signed in to change notification settings - Fork 8
Number
The Number field uses an HTML 5 number input. Additionally, a jQuery UI slider can be enabled.
You can adjust the minimum and maximum attributes of the field. Those will apply to both the <input type="number" />
element, as well as the slider when it is enabled.
In the interface, use the "Minimum" and "Maximum" settings.
In PHP, use the set_minimum
and set_maximum
methods:
Field::create( 'number', 'columns' )
->set_minimum( 1 )
->set_maximum( 3 )
Just like the minimum and maximum attribute, you can adjust the step of the number field:
Field::create( 'number', 'animation_speed', 'Animation speed (ms)' )
->set_default_value( 600 )
->set_step( 100 )
Enabling the jQuery UI Slider requires a minumum and maximum value to be set.
In the UI, set the min/max and check the "Enable Slider" checkbox.
In PHP, use the enable_slider( $minimum, $maximum, $step = 1 )
method. You may skip the step:
Field::create( 'number', 'animation_speed' )
->enable_slider( 200, 1200, 100 )
All API Functions will return/display a number.
Quick start
- Creating fields and using their values
- Installation
- Administration interface
- Using the PHP API
- Container Settings
Locations
- Overview & Usage
- Post Type
- Options Page
- Taxonomy
- Comment
- User
- Widget
- Shortcode
- Menu Item
- Attachment
- Customizer
Fields
- Fields
- Text
- Textarea
- WYSIWYG
- Password
- Checkbox
- Select
- Multiselect
- Image Select
- File
- Image
- Audio
- Video
- Gallery
- WP Object
- WP Objects
- Link
- Date
- DateTime
- Time
- Color
- Font
- Icon
- Map
- Embed
- Number
- Sidebar
- Complex
- Repeater
- Layout
- Section
- Tab
- Message
Features
- Adding fields to the Customizer
- Conditional Logic
- Front-End Forms
- Administration columns
- Import and Export
- REST API
- JSON Synchronization
- Yoast SEO
Ultimate Post Types
Functions and API
Tutorials