add_setting( 'layout_style4', array( * 'default' => array( 'no-sidebar', 'right-sidebar' ), * 'sanitize_callback' => 'sanitize_multi_checkbox' * ) ); * * $wp_customize->add_control( new Beetan_Customize_Checkbox_Multiple_Control( $wp_customize, 'layout_style2', array( * 'label' => esc_html__( 'Layout 2', 'beetan' ), * 'description' => __( 'Choose a layout for the blog posts.', 'beetan' ), * 'section' => 'blog_options', * 'choices' => array( * 'no-sidebar' => esc_html__( 'No Sidebar', 'beetan' ), * 'left-sidebar' => esc_html__( 'Left Sidebar', 'beetan' ), * 'right-sidebar' => esc_html__( 'Right Sidebar', 'beetan' ), * ) * ) ) ); */ if ( ! class_exists( 'Beetan_Customize_Checkbox_Multiple_Control' ) ): class Beetan_Customize_Checkbox_Multiple_Control extends WP_Customize_Control { public $type = 'checkbox-multiple'; public function enqueue() { $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; wp_enqueue_script( 'customize-checkbox-multiple-control', esc_url( get_theme_file_uri( "/assets/js/customize-checkbox-multiple-control$suffix.js" ) ), array( 'jquery' ), FALSE, TRUE ); } protected function render_content() { if ( empty( $this->choices ) ) { return; } ?> label ) ) : ?> label ); ?> value() ) ? explode( ',', $this->value() ) : $this->value(); ?>