get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; $wp_customize->get_setting( 'background_color' )->transport = 'postMessage'; $wp_customize->get_setting( 'background_image' )->transport = 'postMessage'; $wp_customize->add_section( 'eighties_theme_options', array( 'title' => __( 'Theme', 'eighties' ), 'priority' => 130, ) ); /** * Singular Header Options * * Add a options for using the featured image in lieu * of the header image and the item title in lieu of the * site tite for singular items. * */ // Add setting for the singular header image control. $wp_customize->add_setting( 'eighties_singular_header_image', array( 'default' => 'header', 'transport' => 'postMessage', 'sanitize_callback' => 'eighties_sanitize_singular_header_image', ) ); // Add control for the singulare header image. $wp_customize->add_control( 'eighties_singular_header_image', array( 'label' => __( 'Single Posts Display:', 'eighties' ), 'section' => 'eighties_theme_options', 'type' => 'radio', 'choices' => array( 'header' => __( 'Custom Header Image', 'eighties' ), 'featured_image' => __( 'Featured Image', 'eighties' ), ), ) ); } add_action( 'customize_register', 'eighties_customize_register' ); /** * Sanitize the Singular header Image Display value. * * @param string $image. * @return string (header|featured_image). */ function eighties_sanitize_singular_header_image( $image ) { if ( ! in_array( $image, array( 'header', 'featured_image' ) ) ) { $image = 'header'; } return $image; } /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function eighties_customize_preview_js() { wp_enqueue_script( 'eighties-customizer-preview', get_template_directory_uri() . '/js/customizer-preview.js', array( 'customize-preview' ), '20140803', true ); } add_action( 'customize_preview_init', 'eighties_customize_preview_js' );