Ticket #37516: theme-mod-37516.diff
File theme-mod-37516.diff, 6.5 KB (added by , 7 years ago) |
---|
-
src/wp-content/themes/twentyseventeen/functions.php
55 55 56 56 add_image_size( 'twentyseventeen-thumbnail-avatar', 100, 100, true ); 57 57 58 add_theme_support( 'custom-title-tagline' ); 59 58 60 // Set the default content width. 59 61 $GLOBALS['content_width'] = 525; 60 62 -
src/wp-content/themes/twentyseventeen/inc/customizer.php
19 19 20 20 $wp_customize->selective_refresh->add_partial( 'blogname', array( 21 21 'selector' => '.site-title a', 22 'settings' => array( 'blogname', 'header_display_title' ), 22 23 'render_callback' => 'twentyseventeen_customize_partial_blogname', 23 24 ) ); 24 25 $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 25 26 'selector' => '.site-description', 27 'settings' => array( 'blogdescription', 'header_display_tagline' ), 26 28 'render_callback' => 'twentyseventeen_customize_partial_blogdescription', 27 29 ) ); 28 30 … … 163 165 * @return void 164 166 */ 165 167 function twentyseventeen_customize_partial_blogname() { 166 bloginfo( 'name' ); 168 if ( get_theme_mod( 'header_display_title' ) ) { 169 bloginfo( 'name' ); 170 } 167 171 } 168 172 169 173 /** … … 175 179 * @return void 176 180 */ 177 181 function twentyseventeen_customize_partial_blogdescription() { 178 bloginfo( 'description' ); 182 if ( get_theme_mod( 'header_display_tagline' ) ) { 183 bloginfo( 'description' ); 184 } 179 185 } 180 186 181 187 /** -
src/wp-content/themes/twentyseventeen/template-parts/header/site-branding.php
16 16 17 17 <div class="site-branding-text"> 18 18 <?php if ( is_front_page() ) : ?> 19 <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1> 19 <?php if ( get_theme_mod( 'header_display_title', true ) ) : ?> 20 <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1> 21 <?php endif; ?> 20 22 <?php else : ?> 21 <p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p> 23 <?php if ( get_theme_mod( 'header_display_title', true ) ) : ?> 24 <p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p> 25 <?php endif; ?> 22 26 <?php endif; ?> 23 27 24 28 <?php … … 26 30 27 31 if ( $description || is_customize_preview() ) : 28 32 ?> 29 <p class="site-description"><?php echo $description; ?></p> 33 <?php if ( get_theme_mod( 'header_display_tagline', true ) ) : ?> 34 <p class="site-description"><?php echo $description; ?></p> 35 <?php endif; ?> 30 36 <?php endif; ?> 31 37 </div><!-- .site-branding-text --> 32 38 -
src/wp-includes/class-wp-customize-manager.php
4810 4810 'section' => 'title_tagline', 4811 4811 ) ); 4812 4812 4813 // Theme feature for enabling and disabling the site title 4814 if ( current_theme_supports( 'custom-title-tagline', 'display-title' ) ) { 4815 $this->add_setting( 'header_display_title', array( 4816 'default' => get_option( 'blogname' ), 4817 'transport' => 'postMessage', 4818 'sanitize_callback' => 'absint', 4819 ) ); 4820 4821 $this->add_control( 'header_display_title', array( 4822 'label' => __( 'Display Site Title' ), 4823 'section' => 'title_tagline', 4824 'settings' => 'header_display_title', 4825 'type' => 'checkbox', 4826 ) ); 4827 } 4828 4829 // Theme feature for enabling and disabling the site tagline 4830 if ( current_theme_supports( 'custom-title-tagline', 'display-tagline' ) ) { 4831 $this->add_setting( 'header_display_tagline', array( 4832 'default' => get_option( 'blogdescrption' ), 4833 'transport' => 'postMessage', 4834 'sanitize_callback' => 'absint', 4835 ) ); 4836 4837 $this->add_control( 'header_display_tagline', array( 4838 'label' => __( 'Display Site Tagline' ), 4839 'section' => 'title_tagline', 4840 'settings' => 'header_display_tagline', 4841 'type' => 'checkbox', 4842 ) ); 4843 } 4844 4813 4845 // Add a setting to hide header text if the theme doesn't support custom headers. 4814 if ( ! current_theme_supports( 'custom-header', 'header-text' ) ) {4846 if ( ! current_theme_supports( 'custom-header', 'header-text' ) && ! current_theme_supports( 'custom-title-tagline' ) ) { 4815 4847 $this->add_setting( 'header_text', array( 4816 4848 'theme_supports' => array( 'custom-logo', 'header-text' ), 4817 4849 'default' => 1, … … 4895 4927 4896 4928 // Input type: checkbox 4897 4929 // With custom value 4898 $this->add_control( 'display_header_text', array( 4899 'settings' => 'header_textcolor', 4900 'label' => __( 'Display Site Title and Tagline' ), 4901 'section' => 'title_tagline', 4902 'type' => 'checkbox', 4903 'priority' => 40, 4904 ) ); 4930 if ( !current_theme_supports( 'custom-title-tagline' ) ) { 4931 $this->add_control( 'display_header_text', array( 4932 'settings' => 'header_textcolor', 4933 'label' => __( 'Display Site Title and Tagline' ), 4934 'section' => 'title_tagline', 4935 'type' => 'checkbox', 4936 'priority' => 40, 4937 ) ); 4938 } 4905 4939 4906 4940 $this->add_control( new WP_Customize_Color_Control( $this, 'header_textcolor', array( 4907 4941 'label' => __( 'Header Text Color' ), -
src/wp-includes/theme.php
2419 2419 2420 2420 return false; 2421 2421 } 2422 2423 break; 2424 2425 case 'custom-title-tagline': 2426 if ( ! is_array( $args ) ) { 2427 $args = array( 2428 0 => array(), 2429 ); 2430 } 2431 2432 $defaults = array( 2433 'display-title' => true, 2434 'display-tagline' => true, 2435 ); 2436 2437 $args[0] = wp_parse_args( array_intersect_key( $args[0], $defaults ), $defaults ); 2438 2439 break; 2440 2422 2441 } 2423 2442 2424 2443 $_wp_theme_features[ $feature ] = $args;