我正在使用主题定制器,试图找到一种方法来检查两个设置。下面是我的代码,并解释了它的作用:
// start a setting called \'twsa_show_active_days\'
$wp_customize->add_setting( \'twsa_show_active_days\' );
// add options to the setting, in this case a radio to select three options
$wp_customize->add_control( \'twsa_show_active_days\', array(
\'description\' => \'Weekdays and/or weekends?\',
\'type\' => \'radio\',
\'section\' => \'twsa_show\',
\'choices\' => array(
\'weekdays\' => \'Weekdays\',
\'plus_sat\' => \'Weekdays plus Saturday\',
\'full_week\' => \'Weekdays plus Saturday & Sunday\'),
// active callback to check if \'active\' is selected in another setting
\'active_callback\' => function() use ( $wp_customize ) {
return \'active\' === $wp_customize->get_setting( \'twsa_show_schedule\' )->value();
},
// another active_callback to check if \'twsa_show_active\' is selected in another setting
\'active_callback\' => function() use ( $wp_customize ) {
return \'daily\' === $wp_customize->get_setting( \'twsa_show_active\' )->value();
}) );
我的问题是,你如何使用
active_callback
要检查两个设置?它在一个设置下工作,但我需要它来检查两个设置。是否需要创建函数?