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 for the 4.7 branch.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39448 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Helen Hou-Sandi 2016-12-02 23:02:15 +00:00
parent 75ce33e358
commit 87e16e3ce3
2 changed files with 10 additions and 3 deletions

View File

@ -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' );
}
});

View File

@ -69,7 +69,7 @@ function twentyseventeen_header_style() {
// If we get this far, we have custom styles. Let's do this.
?>
<style type="text/css">
<style id="twentyseventeen-custom-header-styles" type="text/css">
<?php
// Has the text been hidden?
if ( 'blank' === $header_text_color ) :