When trying to add a checkbox to the theme customizer it seems to be ‘always’ selected. If you try to deselect it you cannot, almost as if there is some JS code forcing it to stay selected.
I am using serialized theme options and everything is hooked up correctly. Code is similar to the following (triggered via the ‘customize_register’ hook):
$wp_customize->add_setting( mytheme_options[chk_hide_description], array(
'default' => false,
'type' => 'option',
'capability' => 'edit_theme_options' )
);
$wp_customize->add_control( 'display_header_text', array(
'settings' => mytheme_options[chk_hide_description],
'label' => __( 'Hide site description' ),
'section' => 'title_tagline',
'type' => 'checkbox',
) );
Same issue reported here: http://ottopress.com/2012/how-to-leverage-the-theme-customizer-in-your-own-themes/#div-comment-11254.
Checkbox is possible. A example, I hope this help you.
At first you must define the setting, via add_setting
, important is the param type
with value option
. After this control the field via add_control
and set the param type
to checkbox
. Alternative it is possible to use select
. If I add a default value via std
, then work it, also without this param. Alternative works also fine, if I add the choices parameter with the values 1 and 0. But on the tests works fine, if I set the param only to checkbox
. You find the source inside my project, see link below.
Also you can debug the output on value string on the line 246 in the wp-includes/class-wp-customize-control.php; maybe it helps.
debug:
case 'checkbox':
var_dump( $this->value() );
Example:
// Add settings for output description
$wp_customize->add_setting( $this->option_key . '[echo_desc]', array(
'default' => $defaults['echo_desc'],
'type' => 'option',
'capability' => 'edit_theme_options'
) );
// Add control and output for select field
$wp_customize->add_control( $this->option_key . '_echo_desc', array(
'label' => __( 'Display Description', 'documentation' ),
'section' => 'title_tagline',
'settings' => $this->option_key . '[echo_desc]',
'type' => 'checkbox',
'std' => '1'
) );
See the result of this source.

You find a working result in my theme Documentation, hosted on Github.