WOO customizer设置位于“woocommerce”定制器面板下(自WP 4.0以来已添加该面板)
add_action(\'customize_register\',"SE_add_options_t_woo_customizer");
function SE_add_options_t_woo_customizer($wp_customize ){
$wp_customize->add_section( "my_new_section" ,
array(
\'title\' => "My new section",
\'priority\' => 20,
\'panel\' => \'woocommerce\', // here is where you grab the woocommerce panel to add settings and controls to
)
);
$wp_customize->add_setting(\'my_new_setting\',
array(
\'default\' => \'no\',
\'type\' => \'option\',
\'capability\' => \'manage_woocommerce\',
\'sanitize_callback\' => \'wc_bool_to_string\',
\'sanitize_js_callback\' => \'wc_string_to_bool\',
)
);
$wp_customize->add_control(\'my_new_control\',
array(
\'label\' => __( \'Control\', \'woocommerce\' ),
\'description\' => __( \'This is my new control\', \'woocommerce\' ),
\'section\' => \'my_new_section\',
\'settings\' => \'my_new_setting\',
\'type\' => \'checkbox\',
)
);
}