Make WordPress Core

Ticket #37516: combined-37516.diff

File combined-37516.diff, 5.9 KB (added by tellyworth, 6 years ago)

Updated to combine both patches, remove debug, and fix for coding standards.

  • src/wp-content/themes/twentyseventeen/functions.php

     
    5555
    5656        add_image_size( 'twentyseventeen-thumbnail-avatar', 100, 100, true );
    5757
     58        add_theme_support( 'custom-title-tagline' );
     59
    5860        // Set the default content width.
    5961        $GLOBALS['content_width'] = 525;
    6062
  • src/wp-content/themes/twentyseventeen/inc/customizer.php

     
    1919
    2020        $wp_customize->selective_refresh->add_partial( 'blogname', array(
    2121                'selector' => '.site-title a',
     22                'settings' => array( 'blogname', 'header_display_title' ),
    2223                'render_callback' => 'twentyseventeen_customize_partial_blogname',
    2324        ) );
    2425        $wp_customize->selective_refresh->add_partial( 'blogdescription', array(
    2526                'selector' => '.site-description',
     27                'settings' => array( 'blogdescription', 'header_display_tagline' ),
    2628                'render_callback' => 'twentyseventeen_customize_partial_blogdescription',
    2729        ) );
    2830
     
    163165 * @return void
    164166 */
    165167function twentyseventeen_customize_partial_blogname() {
    166         bloginfo( 'name' );
     168        if ( get_option( 'header_display_title' ) ) {
     169                bloginfo( 'name' );
     170        }
    167171}
    168172
    169173/**
     
    175179 * @return void
    176180 */
    177181function twentyseventeen_customize_partial_blogdescription() {
    178         bloginfo( 'description' );
     182        if ( get_option( 'header_display_tagline' ) ) {
     183                bloginfo( 'description' );
     184        }
    179185}
    180186
    181187/**
  • src/wp-content/themes/twentyseventeen/template-parts/header/site-branding.php

     
    1616
    1717                <div class="site-branding-text">
    1818                        <?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_option( 'header_display_title' ) ) : ?>
     20                                        <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
     21                                <?php endif; ?>
    2022                        <?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_option( 'header_display_title' ) ) : ?>
     24                                        <p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
     25                                <?php endif; ?>
    2226                        <?php endif; ?>
    2327
    2428                        <?php
     
    2630
    2731                        if ( $description || is_customize_preview() ) :
    2832                        ?>
    29                                 <p class="site-description"><?php echo $description; ?></p>
     33                                <?php if ( get_option( 'header_display_tagline' ) ) : ?>
     34                                        <p class="site-description"><?php echo $description; ?></p>
     35                                <?php endif; ?>
    3036                        <?php endif; ?>
    3137                </div><!-- .site-branding-text -->
    3238
  • src/wp-includes/class-wp-customize-manager.php

     
    44554455                        'section'    => 'title_tagline',
    44564456                ) );
    44574457
     4458                // Theme feature for enabling and disabling the site title
     4459                if ( current_theme_supports( 'custom-title-tagline', 'display-title' ) ) {
     4460                        $this->add_setting( 'header_display_title', array(
     4461                                'default'    => get_option( 'header_display_title' ) || get_option( 'blogname' ),
     4462                                'type'       => 'option',
     4463                                'capability' => 'manage_options',
     4464                                'transport'         => 'postMessage',
     4465                                'sanitize_callback' => 'absint',
     4466                        ) );
     4467
     4468                        $this->add_control( 'header_display_title', array(
     4469                                'label'    => __( 'Display Site Title' ),
     4470                                'section'  => 'title_tagline',
     4471                                'settings' => 'header_display_title',
     4472                                'type'     => 'checkbox',
     4473                        ) );
     4474                }
     4475
     4476                // Theme feature for enabling and disabling the site tagline
     4477                if ( current_theme_supports( 'custom-title-tagline', 'display-tagline' ) ) {
     4478                        $this->add_setting( 'header_display_tagline', array(
     4479                                'default'    => get_option( 'header_display_tagline' ) || get_option( 'blogdescrption' ),
     4480                                'type'       => 'option',
     4481                                'capability' => 'manage_options',
     4482                                'transport'         => 'postMessage',
     4483                                'sanitize_callback' => 'absint',
     4484                        ) );
     4485
     4486                        $this->add_control( 'header_display_tagline', array(
     4487                                'label'    => __( 'Display Site Tagline' ),
     4488                                'section'  => 'title_tagline',
     4489                                'settings' => 'header_display_tagline',
     4490                                'type'     => 'checkbox',
     4491                        ) );
     4492                }
     4493
    44584494                // Add a setting to hide header text if the theme doesn't support custom headers.
    4459                 if ( ! current_theme_supports( 'custom-header', 'header-text' ) ) {
     4495                if ( ! current_theme_supports( 'custom-header', 'header-text' ) && ! current_theme_supports( 'custom-title-tagline' ) ) {
    44604496                        $this->add_setting( 'header_text', array(
    44614497                                'theme_supports'    => array( 'custom-logo', 'header-text' ),
    44624498                                'default'           => 1,
  • src/wp-includes/theme.php

     
    24192419
    24202420                                return false;
    24212421                        }
     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
    24222441        }
    24232442
    24242443        $_wp_theme_features[ $feature ] = $args;