Last active
August 5, 2022 13:36
-
-
Save albarin/ed365a35083b1861d7deeacba268cf29 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'customize_register', 'test_customize_register' ); | |
function test_customize_register($wp_customize) { | |
$wp_customize->add_section( | |
'test_section', | |
array( | |
'title' => __( 'Test section', 'woocommerce' ), | |
'priority' => 10, | |
'panel' => 'woocommerce', | |
) | |
); | |
$wp_customize->add_setting( | |
'test_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( | |
'test_setting', | |
array( | |
'label' => __( 'Enable it!', 'woocommerce' ), | |
'section' => 'test_section', | |
'settings' => 'test_setting', | |
'type' => 'checkbox', | |
) | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment