当尝试向主题定制器添加复选框时,它似乎是“始终”选中的。如果您试图取消选择它,您就不能,就像有一些JS代码迫使它保持选中状态一样。
我正在使用序列化主题选项,所有内容都已正确连接。代码类似于以下代码(通过“customize\\u register”挂钩触发):
$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\',
) );
此处报告的问题相同:http://ottopress.com/2012/how-to-leverage-the-theme-customizer-in-your-own-themes/#div-comment-11254.