diff --git a/wp-content/themes/twentyseventeen/assets/js/customize-preview.js b/wp-content/themes/twentyseventeen/assets/js/customize-preview.js index 74b4072b71..4981980b5d 100644 --- a/wp-content/themes/twentyseventeen/assets/js/customize-preview.js +++ b/wp-content/themes/twentyseventeen/assets/js/customize-preview.js @@ -102,4 +102,32 @@ } } ); } ); + + // Whether a header image is available. + function hasHeaderImage() { + var image = wp.customize( 'header_image' )(); + return '' !== image && 'remove-header' !== image; + } + + // Whether a header video is available. + function hasHeaderVideo() { + var externalVideo = wp.customize( 'external_header_video' )(), + video = wp.customize( 'header_video' )(); + + return '' !== externalVideo || ( 0 !== video && '' !== video ); + } + + // Toggle a body class if a custom header exists. + $.each( [ 'external_header_video', 'header_image', 'header_video' ], function( index, settingId ) { + wp.customize( settingId, function( setting ) { + setting.bind(function() { + if ( hasHeaderImage() || ( hasHeaderVideo() && $( 'body' ).hasClass( 'twentyseventeen-front-page' ) ) ) { + $( document.body ).addClass( 'has-header-image' ); + } else { + $( document.body ).removeClass( 'has-header-image' ); + } + } ); + } ); + } ); + } )( jQuery ); diff --git a/wp-content/themes/twentyseventeen/style.css b/wp-content/themes/twentyseventeen/style.css index 96db6648c9..61eb2f4262 100644 --- a/wp-content/themes/twentyseventeen/style.css +++ b/wp-content/themes/twentyseventeen/style.css @@ -1690,8 +1690,10 @@ body:not(.title-tagline-hidden) .site-branding-text { transform: translateX(-50%) translateY(0); } +/* Hides div in Customizer preview when header images or videos change. */ + body:not(.has-header-image) .custom-header-image { - padding: 5% 0; + display: none; } .has-header-image.twentyseventeen-front-page .site-branding, diff --git a/wp-includes/version.php b/wp-includes/version.php index 8087608771..b8ba8bd947 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.7-beta3-39219'; +$wp_version = '4.7-beta3-39220'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.