wp/wp-content/themes/twentyfifteen/inc/customizer.php
changeset 7 cf61fcea0001
parent 5 5e2f62d02dcd
--- a/wp/wp-content/themes/twentyfifteen/inc/customizer.php	Tue Jun 09 11:14:17 2015 +0000
+++ b/wp/wp-content/themes/twentyfifteen/inc/customizer.php	Mon Oct 14 17:39:30 2019 +0200
@@ -20,6 +20,19 @@
 	$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' => 'twentyfifteen_customize_partial_blogname',
+		) );
+		$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
+			'selector' => '.site-description',
+			'container_inclusive' => false,
+			'render_callback' => 'twentyfifteen_customize_partial_blogdescription',
+		) );
+	}
+
 	// Add color scheme setting and control.
 	$wp_customize->add_setting( 'color_scheme', array(
 		'default'           => 'default',
@@ -70,6 +83,30 @@
 add_action( 'customize_register', 'twentyfifteen_customize_register', 11 );
 
 /**
+ * Render the site title for the selective refresh partial.
+ *
+ * @since Twenty Fifteen 1.5
+ * @see twentyfifteen_customize_register()
+ *
+ * @return void
+ */
+function twentyfifteen_customize_partial_blogname() {
+	bloginfo( 'name' );
+}
+
+/**
+ * Render the site tagline for the selective refresh partial.
+ *
+ * @since Twenty Fifteen 1.5
+ * @see twentyfifteen_customize_register()
+ *
+ * @return void
+ */
+function twentyfifteen_customize_partial_blogdescription() {
+	bloginfo( 'description' );
+}
+
+/**
  * Register color schemes for Twenty Fifteen.
  *
  * Can be filtered with {@see 'twentyfifteen_color_schemes'}.
@@ -87,6 +124,27 @@
  * @return array An associative array of color scheme options.
  */
 function twentyfifteen_get_color_schemes() {
+	/**
+	 * Filter the color schemes registered for use with Twenty Fifteen.
+	 *
+	 * The default schemes include 'default', 'dark', 'yellow', 'pink', 'purple', and 'blue'.
+	 *
+	 * @since Twenty Fifteen 1.0
+	 *
+	 * @param array $schemes {
+	 *     Associative array of color schemes data.
+	 *
+	 *     @type array $slug {
+	 *         Associative array of information for setting up the color scheme.
+	 *
+	 *         @type string $label  Color scheme label.
+	 *         @type array  $colors HEX codes for default colors prepended with a hash symbol ('#').
+	 *                              Colors are defined in the following order: Main background, sidebar
+	 *                              background, box background, main text and link, sidebar text and link,
+	 *                              meta box background.
+	 *     }
+	 * }
+	 */
 	return apply_filters( 'twentyfifteen_color_schemes', array(
 		'default' => array(
 			'label'  => __( 'Default', 'twentyfifteen' ),