#22177 closed defect (bug) (invalid)
Adding theme customizer checkbox
Reported by: | dgwyer | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | major | Version: | 3.4.2 |
Component: | Customize | Keywords: | |
Focuses: | Cc: |
Description
I have an issue when adding a simple checkbox to the theme customizer from one of my themes. I then tried to do the same in Twenty Eleven but had the same result.
I think there 'may' be a conflict with the 'Display Header Text' checkbox which is added to the customizer from WordPress core. Reason is because this checkbox disappears when I try adding a checkbox of my own.
Code I added to Twenty Eleven is as follows:
function theme_customizer_register_tagline_checkbox($wp_customize) { $wp_customize->add_section( 'my_tagline_section', array( 'title' => 'My Tagline Section', ) ); $wp_customize->add_setting( 'test_checkbox_setting_1624', array( 'default' => null, 'type' => 'option', 'capability' => 'edit_theme_options' ) ); $wp_customize->add_control( 'display_header_text', array( 'settings' => 'test_checkbox_setting_1624', 'label' => 'Customizer checkbox', 'section' => 'my_tagline_section', 'type' => 'checkbox', ) ); } add_action( 'customize_register', 'theme_customizer_register_tagline_checkbox' );
Change History (5)
Note: See
TracTickets for help on using
tickets.
In the line
you seem to be using an existing ID. You should probably use someting unique and new here, that identifies your checkbox.
What happens when you change that parameter to something else?