WordPress.org

Make WordPress Core

Ticket #38737: 38737.5.diff

File 38737.5.diff, 4.6 KB (added by westonruter, 5 years ago)
  • src/wp-content/themes/twentyseventeen/inc/customizer.php

    diff --git src/wp-content/themes/twentyseventeen/inc/customizer.php src/wp-content/themes/twentyseventeen/inc/customizer.php
    index 6e2db28..5963f79 100644
    function twentyseventeen_customize_register( $wp_customize ) { 
    1616        $wp_customize->get_setting( 'blogname' )->transport          = 'postMessage';
    1717        $wp_customize->get_setting( 'blogdescription' )->transport   = 'postMessage';
    1818        $wp_customize->get_setting( 'header_textcolor' )->transport  = 'postMessage';
    19         $wp_customize->get_setting( 'header_image' )->transport      = 'postMessage';
    20         $wp_customize->get_setting( 'header_image_data' )->transport = 'postMessage';
    2119
    2220        $wp_customize->selective_refresh->add_partial( 'blogname', array(
    2321                'selector' => '.site-title a',
  • src/wp-content/themes/twentyseventeen/template-parts/header/header-image.php

    diff --git src/wp-content/themes/twentyseventeen/template-parts/header/header-image.php src/wp-content/themes/twentyseventeen/template-parts/header/header-image.php
    index 17ea8af..5dea9d8 100644
     
    1010
    1111?>
    1212<div class="custom-header">
    13         <?php
    1413
    15         // Check if Custom Header image has been added.
    16         if ( has_custom_header() ) :
    17         ?>
     14        <div class="custom-header-image">
     15                <?php the_custom_header_markup(); ?>
     16        </div>
    1817
    19                 <?php // Output the full custom header - video and/or image fallback. ?>
    20                 <div class="custom-header-image">
    21                         <?php the_custom_header_markup(); ?>
    22                 </div>
    23                 <?php get_template_part( 'template-parts/header/site', 'branding' ); ?>
    24 
    25         <?php else : ?>
    26 
    27                 <?php // Otherwise, show a blank header. ?>
    28                 <div class="custom-header-simple">
    29                         <?php get_template_part( 'template-parts/header/site', 'branding' ); ?>
    30                 </div><!-- .custom-header-simple -->
    31 
    32         <?php endif; ?>
     18        <?php get_template_part( 'template-parts/header/site', 'branding' ); ?>
    3319
    3420</div><!-- .custom-header -->
  • src/wp-includes/class-wp-customize-manager.php

    diff --git src/wp-includes/class-wp-customize-manager.php src/wp-includes/class-wp-customize-manager.php
    index 150b123..81bd4d1 100644
    final class WP_Customize_Manager { 
    34623462                        'theme_supports' => 'custom-header',
    34633463                ) ) );
    34643464
     3465                // Switch image settings to post message when video support is enabled.
     3466                if ( current_theme_supports( 'custom-header', 'video' ) ) {
     3467                        $this->get_setting( 'header_image' )->transport = 'postMessage';
     3468                        $this->get_setting( 'header_image_data' )->transport = 'postMessage';
     3469                }
     3470
    34653471                $this->add_control( new WP_Customize_Media_Control( $this, 'header_video', array(
    34663472                        'theme_supports' => array( 'custom-header', 'video' ),
    34673473                        'label'          => __( 'Header Video' ),
  • src/wp-includes/css/customize-preview.css

    diff --git src/wp-includes/css/customize-preview.css src/wp-includes/css/customize-preview.css
    index c72675e..e099b30 100644
     
    7474                     0 1px 1px #006799,
    7575                     -1px 0 1px #006799;
    7676}
     77.wp-custom-header .customize-partial-edit-shortcut button {
     78        left: 2px
     79}
    7780
    7881.customize-partial-edit-shortcut button svg {
    7982        fill: #fff;
  • src/wp-includes/theme.php

    diff --git src/wp-includes/theme.php src/wp-includes/theme.php
    index bf1c55c..865f851 100644
    function has_custom_header() { 
    14101410/**
    14111411 * Retrieve the markup for a custom header.
    14121412 *
     1413 * The container div will always be returned in the Customizer preview.
     1414 *
    14131415 * @since 4.7.0
    14141416 *
    1415  * @return string|false The markup for a custom header on success. False if not.
     1417 * @return string The markup for a custom header on success.
    14161418 */
    14171419function get_custom_header_markup() {
    1418         if ( ! has_custom_header() ) {
    1419                 return false;
     1420        if ( ! has_custom_header() && ! is_customize_preview() ) {
     1421                return '';
    14201422        }
    14211423
    14221424        return sprintf(
    function get_custom_header_markup() { 
    14281430/**
    14291431 * Print the markup for a custom header.
    14301432 *
     1433 * A container div will always be printed in the Customizer preview.
     1434 *
    14311435 * @since 4.7.0
    14321436 */
    14331437function the_custom_header_markup() {
    1434         if ( ! $custom_header = get_custom_header_markup() ) {
     1438        $custom_header = get_custom_header_markup();
     1439        if ( empty( $custom_header ) ) {
    14351440                return;
    14361441        }
     1442
    14371443        echo $custom_header;
    14381444
    1439         if ( has_header_video() && is_front_page() ) {
     1445        if ( is_front_page() && ( has_header_video() || is_customize_preview() ) ) {
    14401446                wp_enqueue_script( 'wp-custom-header' );
    14411447                wp_localize_script( 'wp-custom-header', '_wpCustomHeaderSettings', get_header_video_settings() );
    14421448        }