Range field
Purpose
A number picked with a slider between a minimum and a maximum.
Field type name
range
Settings
| Setting | Description |
|---|---|
| Instructions | Shown to editors below the field label. (max 2000 characters) |
| Number Type | Whole numbers are returned as integers, decimals as floats. |
| Default Value | Returned when nothing has been saved yet. |
| Minimum | Smallest allowed value. Leave empty for no minimum. |
| Maximum | Largest allowed value. Leave empty for no maximum. |
| Step | Values must be a multiple of the step, counted from the minimum (or 0). |
| Translation | How the field behaves in other languages: translate, copy, copy_once or do_not_translate. Used on top-level fields when WPML is active. See WPML. |
| Width | Width on edit screens, to place fields side by side: 100 (full), 75, 66, 50, 33 or 25 (%). Phones always show full width. |
| Label per language | The label and instructions per language code while editing in that language, e.g. {"nl": {"label": "Prijs"}}. Set on the Translation tab when WPML is active. See WPML. |
PHP return value
int or float, or null.
Example
$rating = cafe_get_field( 'rating' ); // e.g. 8
printf( esc_html__( 'Rated %d out of 10', 'my-theme' ), (int) $rating );