Radio Buttons field
Purpose
One choice from a set of radio buttons.
Field type name
radio
Settings
| Setting | Description |
|---|---|
| Instructions | Shown to editors below the field label. (max 2000 characters) |
| Choices | The options editors can pick. The value is stored; the label is shown. (required) |
| Return Format | What cafe_get_field() returns for a chosen option. |
| Default Value | Choice value returned when nothing has been saved yet. (max 191 characters) |
| Layout | How the options are arranged in the editor. |
| 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
Value, label or [ value, label ] according to Return Format; null when nothing is saved.
Example
$size = cafe_get_field( 'size' ); // "large"
if ( 'large' === $size ) {
// …
}