我有两个控件,其中一个取决于另一个控件的显示:
$wp_customize->add_section(
\'woo_enchancements\',
[
\'title\' => __( \'WooCommerce Enchancements\', \'_amnth\' ),
\'priority\' => 32,
\'active_callback\' => \'is_woocommerce_active\',
\'description\' => \'Must refresh the page after tweaking settings to see effects.\'
]
);
$wp_customize->add_setting(
\'load_woo_custom_functionality\',
[
\'default\' => \'0\',
\'transport\' => \'refresh\'
]
);
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
\'load_woo_custom_functionality_control\',
[
\'label\' => __( \'Load up Woo Enchancements?\', \'_amnth\' ),
\'section\' => \'woo_enchancements\',
\'settings\' => \'load_woo_custom_functionality\',
\'type\' => \'checkbox\',
]
)
);
$wp_customize->add_setting(
\'display_woo_header\',
[
\'default\' => \'0\',
\'transport\' => \'refresh\'
]
);
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
\'display_woo_header_control\',
[
\'label\' => __( \'Display Woo Header?\', \'_amnth\' ),
\'section\' => \'woo_enchancements\',
\'settings\' => \'display_woo_header\',
\'type\' => \'checkbox\',
\'active_callback\' => \'is_woocommerce_enchanced\'
]
)
);
display_header
取决于
load_woo_custom_functionality
要加载,
but when I set the value of display_header
然后我取消选中
load_woo_custom_functionality
, 当该值应默认为其默认值时,该值仍然保持不变-在这种情况下,
0
.
下面是发生的情况的说明:
没有。我怎样才能确保发生这种情况?