Checkbox field

The checkbox field: use it to switch things on and off.

Return values

String “1” if checkbox is checked.

Example


// Field slug is "checkboxExample"
// Note: $is_checked is not a boolean, but a string with value "1"
$is_checked = simple_fields_value('checkboxExample');
if ($is_checked) {
echo "Yep, it's checked!";
} else {
echo "Nope, it's not checked";
}

Output of above

[code]Nope, it’s not checked![/code]

One thought on “Checkbox field

  1. Pingback: Ask Experts » Displaying checkboxes as repeatable fields using Simplefields in WordPress

Leave a Reply