From 289ced158b85e800150df3ea7378a3a5d39eb8c4 Mon Sep 17 00:00:00 2001 From: "David A. Kennedy" Date: Fri, 2 Dec 2016 23:00:13 +0000 Subject: [PATCH] Twenty Seventeen: Ensure header text color updates in Customizer preview when cleared Checks if the text color has been cleared and removes the `style` block if it has been. Uses color styles in theme stylesheet. Props sstoqnov, davidakennedy. Fixes #38993. git-svn-id: https://develop.svn.wordpress.org/trunk@39447 602fd350-edb4-49c9-b593-d223f7449a82 --- .../twentyseventeen/assets/js/customize-preview.js | 11 +++++++++-- .../themes/twentyseventeen/inc/custom-header.php | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/wp-content/themes/twentyseventeen/assets/js/customize-preview.js b/src/wp-content/themes/twentyseventeen/assets/js/customize-preview.js index e5d4ee16d7..dba7b79b9e 100644 --- a/src/wp-content/themes/twentyseventeen/assets/js/customize-preview.js +++ b/src/wp-content/themes/twentyseventeen/assets/js/customize-preview.js @@ -8,10 +8,10 @@ // Collect information from customize-controls.js about which panels are opening. wp.customize.bind( 'preview-ready', function() { - + // Initially hide the theme option placeholders on load $( '.panel-placeholder' ).hide(); - + wp.customize.preview.bind( 'section-highlight', function( data ) { // Only on the front page. @@ -58,8 +58,14 @@ clip: 'rect(1px, 1px, 1px, 1px)', position: 'absolute' }); + // Add class for different logo styles if title and description are hidden. $( 'body' ).addClass( 'title-tagline-hidden' ); } else { + + // Check if the text color has been removed and use default colors in theme stylesheet. + if ( ! to.length ) { + $( '#twentyseventeen-custom-header-styles' ).remove(); + } $( '.site-title, .site-description' ).css({ clip: 'auto', position: 'relative' @@ -67,6 +73,7 @@ $( '.site-branding, .site-branding a, .site-description, .site-description a' ).css({ color: to }); + // Add class for different logo styles if title and description are visible. $( 'body' ).removeClass( 'title-tagline-hidden' ); } }); diff --git a/src/wp-content/themes/twentyseventeen/inc/custom-header.php b/src/wp-content/themes/twentyseventeen/inc/custom-header.php index 42a89e93d8..92940a8caf 100644 --- a/src/wp-content/themes/twentyseventeen/inc/custom-header.php +++ b/src/wp-content/themes/twentyseventeen/inc/custom-header.php @@ -69,7 +69,7 @@ function twentyseventeen_header_style() { // If we get this far, we have custom styles. Let's do this. ?> -