17 function twentyfifteen_customize_register( $wp_customize ) { |
17 function twentyfifteen_customize_register( $wp_customize ) { |
18 $color_scheme = twentyfifteen_get_color_scheme(); |
18 $color_scheme = twentyfifteen_get_color_scheme(); |
19 |
19 |
20 $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; |
20 $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; |
21 $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; |
21 $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; |
|
22 |
|
23 if ( isset( $wp_customize->selective_refresh ) ) { |
|
24 $wp_customize->selective_refresh->add_partial( 'blogname', array( |
|
25 'selector' => '.site-title a', |
|
26 'container_inclusive' => false, |
|
27 'render_callback' => 'twentyfifteen_customize_partial_blogname', |
|
28 ) ); |
|
29 $wp_customize->selective_refresh->add_partial( 'blogdescription', array( |
|
30 'selector' => '.site-description', |
|
31 'container_inclusive' => false, |
|
32 'render_callback' => 'twentyfifteen_customize_partial_blogdescription', |
|
33 ) ); |
|
34 } |
22 |
35 |
23 // Add color scheme setting and control. |
36 // Add color scheme setting and control. |
24 $wp_customize->add_setting( 'color_scheme', array( |
37 $wp_customize->add_setting( 'color_scheme', array( |
25 'default' => 'default', |
38 'default' => 'default', |
26 'sanitize_callback' => 'twentyfifteen_sanitize_color_scheme', |
39 'sanitize_callback' => 'twentyfifteen_sanitize_color_scheme', |
68 $wp_customize->get_section( 'header_image' )->description = __( 'Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen' ); |
81 $wp_customize->get_section( 'header_image' )->description = __( 'Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen' ); |
69 } |
82 } |
70 add_action( 'customize_register', 'twentyfifteen_customize_register', 11 ); |
83 add_action( 'customize_register', 'twentyfifteen_customize_register', 11 ); |
71 |
84 |
72 /** |
85 /** |
|
86 * Render the site title for the selective refresh partial. |
|
87 * |
|
88 * @since Twenty Fifteen 1.5 |
|
89 * @see twentyfifteen_customize_register() |
|
90 * |
|
91 * @return void |
|
92 */ |
|
93 function twentyfifteen_customize_partial_blogname() { |
|
94 bloginfo( 'name' ); |
|
95 } |
|
96 |
|
97 /** |
|
98 * Render the site tagline for the selective refresh partial. |
|
99 * |
|
100 * @since Twenty Fifteen 1.5 |
|
101 * @see twentyfifteen_customize_register() |
|
102 * |
|
103 * @return void |
|
104 */ |
|
105 function twentyfifteen_customize_partial_blogdescription() { |
|
106 bloginfo( 'description' ); |
|
107 } |
|
108 |
|
109 /** |
73 * Register color schemes for Twenty Fifteen. |
110 * Register color schemes for Twenty Fifteen. |
74 * |
111 * |
75 * Can be filtered with {@see 'twentyfifteen_color_schemes'}. |
112 * Can be filtered with {@see 'twentyfifteen_color_schemes'}. |
76 * |
113 * |
77 * The order of colors in a colors array: |
114 * The order of colors in a colors array: |
85 * @since Twenty Fifteen 1.0 |
122 * @since Twenty Fifteen 1.0 |
86 * |
123 * |
87 * @return array An associative array of color scheme options. |
124 * @return array An associative array of color scheme options. |
88 */ |
125 */ |
89 function twentyfifteen_get_color_schemes() { |
126 function twentyfifteen_get_color_schemes() { |
|
127 /** |
|
128 * Filter the color schemes registered for use with Twenty Fifteen. |
|
129 * |
|
130 * The default schemes include 'default', 'dark', 'yellow', 'pink', 'purple', and 'blue'. |
|
131 * |
|
132 * @since Twenty Fifteen 1.0 |
|
133 * |
|
134 * @param array $schemes { |
|
135 * Associative array of color schemes data. |
|
136 * |
|
137 * @type array $slug { |
|
138 * Associative array of information for setting up the color scheme. |
|
139 * |
|
140 * @type string $label Color scheme label. |
|
141 * @type array $colors HEX codes for default colors prepended with a hash symbol ('#'). |
|
142 * Colors are defined in the following order: Main background, sidebar |
|
143 * background, box background, main text and link, sidebar text and link, |
|
144 * meta box background. |
|
145 * } |
|
146 * } |
|
147 */ |
90 return apply_filters( 'twentyfifteen_color_schemes', array( |
148 return apply_filters( 'twentyfifteen_color_schemes', array( |
91 'default' => array( |
149 'default' => array( |
92 'label' => __( 'Default', 'twentyfifteen' ), |
150 'label' => __( 'Default', 'twentyfifteen' ), |
93 'colors' => array( |
151 'colors' => array( |
94 '#f1f1f1', |
152 '#f1f1f1', |