X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/0459461f9ea42e0b090759ff6fe5f48360bef750..refs/tags/wordpress-4.5:/wp-content/themes/twentysixteen/inc/customizer.php?ds=sidebyside diff --git a/wp-content/themes/twentysixteen/inc/customizer.php b/wp-content/themes/twentysixteen/inc/customizer.php index bc932cff..794752d3 100644 --- a/wp-content/themes/twentysixteen/inc/customizer.php +++ b/wp-content/themes/twentysixteen/inc/customizer.php @@ -106,6 +106,19 @@ function twentysixteen_customize_register( $wp_customize ) { $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; + if ( isset( $wp_customize->selective_refresh ) ) { + $wp_customize->selective_refresh->add_partial( 'blogname', array( + 'selector' => '.site-title a', + 'container_inclusive' => false, + 'render_callback' => 'twentysixteen_customize_partial_blogname', + ) ); + $wp_customize->selective_refresh->add_partial( 'blogdescription', array( + 'selector' => '.site-description', + 'container_inclusive' => false, + 'render_callback' => 'twentysixteen_customize_partial_blogdescription', + ) ); + } + // Add color scheme setting and control. $wp_customize->add_setting( 'color_scheme', array( 'default' => 'default', @@ -174,6 +187,30 @@ function twentysixteen_customize_register( $wp_customize ) { } add_action( 'customize_register', 'twentysixteen_customize_register', 11 ); +/** + * Render the site title for the selective refresh partial. + * + * @since Twenty Sixteen 1.2 + * @see twentysixteen_customize_register() + * + * @return void + */ +function twentysixteen_customize_partial_blogname() { + bloginfo( 'name' ); +} + +/** + * Render the site tagline for the selective refresh partial. + * + * @since Twenty Sixteen 1.2 + * @see twentysixteen_customize_register() + * + * @return void + */ +function twentysixteen_customize_partial_blogdescription() { + bloginfo( 'description' ); +} + /** * Registers color schemes for Twenty Sixteen. * @@ -384,7 +421,7 @@ add_action( 'wp_enqueue_scripts', 'twentysixteen_color_scheme_css' ); * @since Twenty Sixteen 1.0 */ function twentysixteen_customize_control_js() { - wp_enqueue_script( 'color-scheme-control', get_template_directory_uri() . '/js/color-scheme-control.js', array( 'customize-controls', 'iris', 'underscore', 'wp-util' ), '20150926', true ); + wp_enqueue_script( 'color-scheme-control', get_template_directory_uri() . '/js/color-scheme-control.js', array( 'customize-controls', 'iris', 'underscore', 'wp-util' ), '20160412', true ); wp_localize_script( 'color-scheme-control', 'colorScheme', twentysixteen_get_color_schemes() ); } add_action( 'customize_controls_enqueue_scripts', 'twentysixteen_customize_control_js' ); @@ -395,7 +432,7 @@ add_action( 'customize_controls_enqueue_scripts', 'twentysixteen_customize_contr * @since Twenty Sixteen 1.0 */ function twentysixteen_customize_preview_js() { - wp_enqueue_script( 'twentysixteen-customize-preview', get_template_directory_uri() . '/js/customize-preview.js', array( 'customize-preview' ), '20150922', true ); + wp_enqueue_script( 'twentysixteen-customize-preview', get_template_directory_uri() . '/js/customize-preview.js', array( 'customize-preview' ), '20160412', true ); } add_action( 'customize_preview_init', 'twentysixteen_customize_preview_js' );