Checkbox
<?php
$tea_content = array(
array(
'type' => 'checkbox',
'title' => 'What are your preferred personas?',
'id' => 'my_checkbox_field_id',
'default' => array('minions', 'lapinscretins'), //define the default choice(s)
'description' => '',
//define your options
'options' => array(
'minions' => 'The Minions', //value => label
'lapinscretins' => 'The Lapins Crétins',
'marvel' => 'All Marvel Superheroes',
'franklin' => 'Franklin (everything is possible)',
'spongebob' => 'Spongebob (nothing to say... Love it!)',
),
),
);
Retrieve data
Using the _get_option('my_checkbox_field_id')
method, you'll get (with a json_encode()
display):
{
"minions": "minions",
"lapinscretins": "lapinscretins"
}
Updated less than a minute ago