下面是我用来将部分添加到自定义面板的代码。
function apple_customize_register($wp_customize){
$wp_customize->add_section(\'apple_footer\', array(
\'title\' => \'Footer\',
\'priority\' => 120,
));
//------ display copyright in footer
$wp_customize->add_setting(\'theme_options[copyright]\', array(
\'capability\' => \'edit_theme_options\',
\'type\' => \'option\',
));
$wp_customize->add_control(\'theme_options[copyright]\', array(
\'settings\' => \'theme_options[copyright]\',
\'label\' => __(\'Display Copyright\'),
\'section\' => \'apple_footer\',
\'type\' => \'checkbox\',
\'value\' => \'1\'
));
}
add_action(\'customize_register\', \'apple_customize_register\');
如何在主题中使用这些值。我试过了
get_option(\'theme_options[copyright]\')
,
get_theme_mod(\'theme_options[copyright]\')
还有更多,但所有的var\\u都被丢弃了
bool(false)
. 请告诉我我错过了什么。