Cybo Advanced Field EngineCyboweb Technologies · Documentation · v1.0.2

Toggle field

Purpose

A yes/no switch (true/false).

Field type name

toggle

Settings

Setting Description
Instructions Shown to editors below the field label. (max 2000 characters)
Default Value Returned when nothing has been saved yet.
On Text Label shown when the toggle is on. (max 100 characters)
Off Text Label shown when the toggle is off. (max 100 characters)
Switch Style Shape of the switch: rounded or square. Presentation only; the value is the same.
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

Always a real bool (true or false), never "1", "0", "true" or "false". Without a saved value the Default Value (default false) is returned.

Example

if ( cafe_get_field( 'show_banner' ) ) {
	get_template_part( 'parts/banner' );
}