get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; /////General Settings///// $wp_customize->add_section( 'guitara_general_settings', array( 'title' => __('General Settings', 'guitara' ), 'priority' => 35, ) ); //Date format $wp_customize->add_setting( 'guitara_date_format', array( 'default' => 'm-js', ) ); $wp_customize->add_control( 'guitara_date_format', array( 'type' => 'select', 'label' => __('Choose the date format for the index posts.', 'guitara'), 'section' => 'guitara_general_settings', 'choices' => array( 'm-js' => 'Month-Day', 'js-m' => 'Day-Month' ), ) ); /////Single posts/pages///// $wp_customize->add_section( 'guitara_singles', array( 'title' => __('Single posts/pages', 'guitara'), 'priority' => 36, ) ); //Single posts $wp_customize->add_setting( 'guitara_post_img', array( 'sanitize_callback' => 'guitara_sanitize_checkbox', ) ); $wp_customize->add_control( 'guitara_post_img', array( 'type' => 'checkbox', 'label' => __('Check this box to show featured images on single posts', 'guitara'), 'section' => 'guitara_singles', ) ); //Pages $wp_customize->add_setting( 'guitara_page_img', array( 'sanitize_callback' => 'guitara_sanitize_checkbox', ) ); $wp_customize->add_control( 'guitara_page_img', array( 'type' => 'checkbox', 'label' => __('Check this box to show featured images on pages', 'guitara'), 'section' => 'guitara_singles', ) ); //Author bio $wp_customize->add_setting( 'guitara_bio', array( 'sanitize_callback' => 'guitara_sanitize_checkbox', ) ); $wp_customize->add_control( 'guitara_bio', array( 'type' => 'checkbox', 'label' => __('Check this box to display the author bio on single posts. You can add your author bio and social links on the Users screen in the Your Profile section.', 'guitara'), 'section' => 'guitara_singles', ) ); } add_action( 'customize_register', 'guitara_customize_register' ); /** * Sanitization */ function guitara_sanitize_checkbox( $input ) { if ( $input == 1 ) { return 1; } else { return ''; } } function guitara_sanitize_date_format( $input ) { $valid = array( 'm-js' => 'Month-Day', 'j-ms' => 'Day-Month', ); if ( array_key_exists( $input, $valid ) ) { return $input; } else { return ''; } } ?>