18 // Add postMessage support for site title and description. |
18 // Add postMessage support for site title and description. |
19 $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; |
19 $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; |
20 $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; |
20 $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; |
21 $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; |
21 $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; |
22 |
22 |
|
23 if ( isset( $wp_customize->selective_refresh ) ) { |
|
24 $wp_customize->selective_refresh->add_partial( |
|
25 'blogname', array( |
|
26 'selector' => '.site-title a', |
|
27 'container_inclusive' => false, |
|
28 'render_callback' => 'twentyfourteen_customize_partial_blogname', |
|
29 ) |
|
30 ); |
|
31 $wp_customize->selective_refresh->add_partial( |
|
32 'blogdescription', array( |
|
33 'selector' => '.site-description', |
|
34 'container_inclusive' => false, |
|
35 'render_callback' => 'twentyfourteen_customize_partial_blogdescription', |
|
36 ) |
|
37 ); |
|
38 } |
|
39 |
23 // Rename the label to "Site Title Color" because this only affects the site title in this theme. |
40 // Rename the label to "Site Title Color" because this only affects the site title in this theme. |
24 $wp_customize->get_control( 'header_textcolor' )->label = __( 'Site Title Color', 'twentyfourteen' ); |
41 $wp_customize->get_control( 'header_textcolor' )->label = __( 'Site Title Color', 'twentyfourteen' ); |
25 |
42 |
26 // Rename the label to "Display Site Title & Tagline" in order to make this option extra clear. |
43 // Rename the label to "Display Site Title & Tagline" in order to make this option extra clear. |
27 $wp_customize->get_control( 'display_header_text' )->label = __( 'Display Site Title & Tagline', 'twentyfourteen' ); |
44 $wp_customize->get_control( 'display_header_text' )->label = __( 'Display Site Title & Tagline', 'twentyfourteen' ); |
34 $wp_customize->get_section( 'colors' )->description = __( 'Background may only be visible on wide screens.', 'twentyfourteen' ); |
51 $wp_customize->get_section( 'colors' )->description = __( 'Background may only be visible on wide screens.', 'twentyfourteen' ); |
35 $wp_customize->get_section( 'background_image' )->description = __( 'Background may only be visible on wide screens.', 'twentyfourteen' ); |
52 $wp_customize->get_section( 'background_image' )->description = __( 'Background may only be visible on wide screens.', 'twentyfourteen' ); |
36 } |
53 } |
37 |
54 |
38 // Add the featured content section in case it's not already there. |
55 // Add the featured content section in case it's not already there. |
39 $wp_customize->add_section( 'featured_content', array( |
56 $wp_customize->add_section( |
40 'title' => __( 'Featured Content', 'twentyfourteen' ), |
57 'featured_content', array( |
41 'description' => sprintf( __( 'Use a <a href="%1$s">tag</a> to feature your posts. If no posts match the tag, <a href="%2$s">sticky posts</a> will be displayed instead.', 'twentyfourteen' ), |
58 'title' => __( 'Featured Content', 'twentyfourteen' ), |
42 esc_url( add_query_arg( 'tag', _x( 'featured', 'featured content default tag slug', 'twentyfourteen' ), admin_url( 'edit.php' ) ) ), |
59 'description' => sprintf( |
43 admin_url( 'edit.php?show_sticky=1' ) |
60 __( 'Use a <a href="%1$s">tag</a> to feature your posts. If no posts match the tag, <a href="%2$s">sticky posts</a> will be displayed instead.', 'twentyfourteen' ), |
44 ), |
61 esc_url( add_query_arg( 'tag', _x( 'featured', 'featured content default tag slug', 'twentyfourteen' ), admin_url( 'edit.php' ) ) ), |
45 'priority' => 130, |
62 admin_url( 'edit.php?show_sticky=1' ) |
46 'active_callback' => 'is_front_page', |
63 ), |
47 ) ); |
64 'priority' => 130, |
|
65 'active_callback' => 'is_front_page', |
|
66 ) |
|
67 ); |
48 |
68 |
49 // Add the featured content layout setting and control. |
69 // Add the featured content layout setting and control. |
50 $wp_customize->add_setting( 'featured_content_layout', array( |
70 $wp_customize->add_setting( |
51 'default' => 'grid', |
71 'featured_content_layout', array( |
52 'sanitize_callback' => 'twentyfourteen_sanitize_layout', |
72 'default' => 'grid', |
53 ) ); |
73 'sanitize_callback' => 'twentyfourteen_sanitize_layout', |
|
74 ) |
|
75 ); |
54 |
76 |
55 $wp_customize->add_control( 'featured_content_layout', array( |
77 $wp_customize->add_control( |
56 'label' => __( 'Layout', 'twentyfourteen' ), |
78 'featured_content_layout', array( |
57 'section' => 'featured_content', |
79 'label' => __( 'Layout', 'twentyfourteen' ), |
58 'type' => 'select', |
80 'section' => 'featured_content', |
59 'choices' => array( |
81 'type' => 'select', |
60 'grid' => __( 'Grid', 'twentyfourteen' ), |
82 'choices' => array( |
61 'slider' => __( 'Slider', 'twentyfourteen' ), |
83 'grid' => __( 'Grid', 'twentyfourteen' ), |
62 ), |
84 'slider' => __( 'Slider', 'twentyfourteen' ), |
63 ) ); |
85 ), |
|
86 ) |
|
87 ); |
64 } |
88 } |
65 add_action( 'customize_register', 'twentyfourteen_customize_register' ); |
89 add_action( 'customize_register', 'twentyfourteen_customize_register' ); |
|
90 |
|
91 /** |
|
92 * Render the site title for the selective refresh partial. |
|
93 * |
|
94 * @since Twenty Fourteen 1.7 |
|
95 * @see twentyfourteen_customize_register() |
|
96 * |
|
97 * @return void |
|
98 */ |
|
99 function twentyfourteen_customize_partial_blogname() { |
|
100 bloginfo( 'name' ); |
|
101 } |
|
102 |
|
103 /** |
|
104 * Render the site tagline for the selective refresh partial. |
|
105 * |
|
106 * @since Twenty Fourteen 1.7 |
|
107 * @see twentyfourteen_customize_register() |
|
108 * |
|
109 * @return void |
|
110 */ |
|
111 function twentyfourteen_customize_partial_blogdescription() { |
|
112 bloginfo( 'description' ); |
|
113 } |
66 |
114 |
67 /** |
115 /** |
68 * Sanitize the Featured Content layout value. |
116 * Sanitize the Featured Content layout value. |
69 * |
117 * |
70 * @since Twenty Fourteen 1.0 |
118 * @since Twenty Fourteen 1.0 |
98 function twentyfourteen_contextual_help() { |
146 function twentyfourteen_contextual_help() { |
99 if ( 'admin_head-edit.php' === current_filter() && 'post' !== $GLOBALS['typenow'] ) { |
147 if ( 'admin_head-edit.php' === current_filter() && 'post' !== $GLOBALS['typenow'] ) { |
100 return; |
148 return; |
101 } |
149 } |
102 |
150 |
103 get_current_screen()->add_help_tab( array( |
151 get_current_screen()->add_help_tab( |
104 'id' => 'twentyfourteen', |
152 array( |
105 'title' => __( 'Twenty Fourteen', 'twentyfourteen' ), |
153 'id' => 'twentyfourteen', |
106 'content' => |
154 'title' => __( 'Twenty Fourteen', 'twentyfourteen' ), |
107 '<ul>' . |
155 'content' => |
108 '<li>' . sprintf( __( 'The home page features your choice of up to 6 posts prominently displayed in a grid or slider, controlled by a <a href="%1$s">tag</a>; you can change the tag and layout in <a href="%2$s">Appearance → Customize</a>. If no posts match the tag, <a href="%3$s">sticky posts</a> will be displayed instead.', 'twentyfourteen' ), esc_url( add_query_arg( 'tag', _x( 'featured', 'featured content default tag slug', 'twentyfourteen' ), admin_url( 'edit.php' ) ) ), admin_url( 'customize.php' ), admin_url( 'edit.php?show_sticky=1' ) ) . '</li>' . |
156 '<ul>' . |
109 '<li>' . sprintf( __( 'Enhance your site design by using <a href="%s">Featured Images</a> for posts you’d like to stand out (also known as post thumbnails). This allows you to associate an image with your post without inserting it. Twenty Fourteen uses featured images for posts and pages—above the title—and in the Featured Content area on the home page.', 'twentyfourteen' ), 'https://codex.wordpress.org/Post_Thumbnails#Setting_a_Post_Thumbnail' ) . '</li>' . |
157 '<li>' . sprintf( __( 'The home page features your choice of up to 6 posts prominently displayed in a grid or slider, controlled by a <a href="%1$s">tag</a>; you can change the tag and layout in <a href="%2$s">Appearance → Customize</a>. If no posts match the tag, <a href="%3$s">sticky posts</a> will be displayed instead.', 'twentyfourteen' ), esc_url( add_query_arg( 'tag', _x( 'featured', 'featured content default tag slug', 'twentyfourteen' ), admin_url( 'edit.php' ) ) ), admin_url( 'customize.php' ), admin_url( 'edit.php?show_sticky=1' ) ) . '</li>' . |
110 '<li>' . sprintf( __( 'For an in-depth tutorial, and more tips and tricks, visit the <a href="%s">Twenty Fourteen documentation</a>.', 'twentyfourteen' ), 'https://codex.wordpress.org/Twenty_Fourteen' ) . '</li>' . |
158 '<li>' . sprintf( __( 'Enhance your site design by using <a href="%s">Featured Images</a> for posts you’d like to stand out (also known as post thumbnails). This allows you to associate an image with your post without inserting it. Twenty Fourteen uses featured images for posts and pages—above the title—and in the Featured Content area on the home page.', 'twentyfourteen' ), 'https://codex.wordpress.org/Post_Thumbnails#Setting_a_Post_Thumbnail' ) . '</li>' . |
111 '</ul>', |
159 '<li>' . sprintf( __( 'For an in-depth tutorial, and more tips and tricks, visit the <a href="%s">Twenty Fourteen documentation</a>.', 'twentyfourteen' ), 'https://codex.wordpress.org/Twenty_Fourteen' ) . '</li>' . |
112 ) ); |
160 '</ul>', |
|
161 ) |
|
162 ); |
113 } |
163 } |
114 add_action( 'admin_head-themes.php', 'twentyfourteen_contextual_help' ); |
164 add_action( 'admin_head-themes.php', 'twentyfourteen_contextual_help' ); |
115 add_action( 'admin_head-edit.php', 'twentyfourteen_contextual_help' ); |
165 add_action( 'admin_head-edit.php', 'twentyfourteen_contextual_help' ); |