remove_control( 'blogdescription' ); $wp_customize->remove_control( 'header_textcolor' ); $wp_customize->remove_control( 'display_header_text' ); $sections = array( 'bands_options' => array( 'title' => __( 'Layout & Display', 'bands' ), 'priority' => 20 ), 'bands_fonts' => array( 'title' => esc_html__( 'Fonts', 'bands' ), 'priority' => 25 ) ); foreach ( $sections as $section_id => $section_args ) { $wp_customize->add_section( $section_id, $section_args ); } $settings = array( 'bands_layout_width' => array( 'default' => '100%', 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'refresh', 'control' => array( 'label' => esc_html__( 'Layout Width', 'bands' ), 'description' => esc_html__( 'Enter any width by % or px (for example, 100% for full width).', 'bands' ), 'section' => 'bands_options', 'type' => 'text' ) ), 'bands_grid_columns' => array( 'default' => '1', 'sanitize_callback' => 'absint', 'transport' => 'refresh', 'control' => array( 'label' => esc_html__( 'Blog Grid Count', 'bands' ), 'section' => 'bands_options', 'type' => 'number' ) ), 'bands_grid_width' => array( 'default' => '300px', 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'refresh', 'control' => array( 'label' => esc_html__( 'Blog Grid Width', 'bands' ), 'description' => esc_html__( 'Enter any width by px only.', 'bands' ), 'section' => 'bands_options', 'type' => 'text' ) ), 'bands_grid_gap' => array( 'default' => '5%', 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'refresh', 'control' => array( 'label' => esc_html__( 'Blog Grid Gap', 'bands' ), 'description' => esc_html__( 'Enter any width by % or px.', 'bands' ), 'section' => 'bands_options', 'type' => 'text' ) ), 'bands_sticky_header' => array( 'default' => '1', 'sanitize_callback' => 'bands_sanitize_checkbox', 'control' => array( 'label' => esc_html__( 'Sticky Header', 'bands' ), 'section' => 'bands_options', 'type' => 'checkbox' ) ), 'bands_center_logo' => array( 'default' => '', 'sanitize_callback' => 'bands_sanitize_checkbox', 'control' => array( 'label' => esc_html__( 'Center Logo', 'bands' ), 'section' => 'bands_options', 'type' => 'checkbox' ) ), 'bands_left_logo' => array( 'default' => '', 'sanitize_callback' => 'bands_sanitize_checkbox', 'control' => array( 'label' => esc_html__( 'Left Logo', 'bands' ), 'section' => 'bands_options', 'type' => 'checkbox' ) ), 'bands_display_sidebar' => array( 'default' => '', 'sanitize_callback' => 'bands_sanitize_checkbox', 'control' => array( 'label' => esc_html__( 'Display Sidebar', 'bands' ), 'section' => 'bands_options', 'type' => 'checkbox' ) ), 'bands_hide_header' => array( 'default' => '', 'sanitize_callback' => 'bands_sanitize_checkbox', 'control' => array( 'label' => esc_html__( 'Hide Header', 'bands' ), 'section' => 'bands_options', 'type' => 'checkbox' ) ), 'bands_hide_branding' => array( 'default' => '', 'sanitize_callback' => 'bands_sanitize_checkbox', 'control' => array( 'label' => esc_html__( 'Hide Logo/Site Title', 'bands' ), 'section' => 'bands_options', 'type' => 'checkbox' ) ), 'bands_hide_menu' => array( 'default' => '', 'sanitize_callback' => 'bands_sanitize_checkbox', 'control' => array( 'label' => esc_html__( 'Hide Menu', 'bands' ), 'section' => 'bands_options', 'type' => 'checkbox' ) ), 'bands_hide_search' => array( 'default' => '', 'sanitize_callback' => 'bands_sanitize_checkbox', 'control' => array( 'label' => esc_html__( 'Hide Search Form', 'bands' ), 'section' => 'bands_options', 'type' => 'checkbox' ) ), 'bands_hide_header_image' => array( 'default' => '', 'sanitize_callback' => 'bands_sanitize_checkbox', 'control' => array( 'label' => esc_html__( 'Hide Header Image', 'bands' ), 'section' => 'bands_options', 'type' => 'checkbox' ) ), 'bands_hide_description' => array( 'default' => '', 'sanitize_callback' => 'bands_sanitize_checkbox', 'control' => array( 'label' => esc_html__( 'Hide Site Description', 'bands' ), 'section' => 'bands_options', 'type' => 'checkbox' ) ), 'bands_hide_breadcrumbs' => array( 'default' => '1', 'sanitize_callback' => 'bands_sanitize_checkbox', 'control' => array( 'label' => esc_html__( 'Hide Breadcrumbs', 'bands' ), 'section' => 'bands_options', 'type' => 'checkbox' ) ), 'bands_hide_footer' => array( 'default' => '', 'sanitize_callback' => 'bands_sanitize_checkbox', 'control' => array( 'label' => esc_html__( 'Hide Footer', 'bands' ), 'section' => 'bands_options', 'type' => 'checkbox' ) ), 'bands_header_font' => array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'refresh', 'control' => array( 'label' => esc_html__( 'Headers Font', 'bands' ), 'description' => esc_html__( 'Google Fonts allowed here too.', 'bands' ), 'section' => 'bands_fonts', 'type' => 'text' ) ), 'bands_content_font' => array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'refresh', 'control' => array( 'label' => esc_html__( 'Content Font', 'bands' ), 'description' => esc_html__( 'Google Fonts allowed here too.', 'bands' ), 'section' => 'bands_fonts', 'type' => 'text' ) ), 'bands_accent_color' => array( 'default' => '', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage', 'control' => array( 'label' => esc_html__( 'Accent Color', 'bands' ), 'section' => 'colors', 'type' => 'color', 'priority' => 0 ) ), 'bands_header_color' => array( 'default' => '', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage', 'control' => array( 'label' => esc_html__( 'Headers Color', 'bands' ), 'section' => 'colors', 'type' => 'color', 'priority' => 1 ) ), 'bands_content_color' => array( 'default' => '', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage', 'control' => array( 'label' => esc_html__( 'Content Color', 'bands' ), 'section' => 'colors', 'type' => 'color', 'priority' => 2 ) ), 'bands_link_color' => array( 'default' => '', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage', 'control' => array( 'label' => esc_html__( 'Link Color', 'bands' ), 'section' => 'colors', 'type' => 'color', 'priority' => 3 ) ) ); foreach ( $settings as $setting_id => $setting_args ) { $wp_customize->add_setting( $setting_id, array( 'default' => $setting_args['default'], 'sanitize_callback' => isset( $setting_args['sanitize_callback'] ) ? $setting_args['sanitize_callback'] : 'sanitize_text_field', 'transport' => isset( $setting_args['transport'] ) ? $setting_args['transport'] : 'refresh' ) ); $control_id = str_replace( 'bands_', '', $setting_id ); $control_args = $setting_args['control']; $control_args['settings'] = $setting_id; if ( $control_args['type'] === 'color' ) { $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, $control_id, $control_args ) ); } else { $wp_customize->add_control( new WP_Customize_Control( $wp_customize, $control_id, $control_args ) ); } } } function bands_sanitize_checkbox( $input ) { if ( $input === true || $input === '1' ) { return '1'; } return ''; } add_action( 'wp_head', 'bands_customizer_css' ); function bands_customizer_css() { ?>