From e3b91071e70a54ba7f3229a07d2746f453c666ff Mon Sep 17 00:00:00 2001 From: Hardeep Asrani Date: Tue, 3 Jul 2018 07:27:26 +0000 Subject: [PATCH] PostMessage in Primary Color Can only do it with Primary Color because pseudo elements don't work with JS' CSS: https://github.com/Codeinwp/amadeus/issues/57 --- inc/customizer.php | 1 + js/customizer.js | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/inc/customizer.php b/inc/customizer.php index 156fd1c..2b0aa42 100644 --- a/inc/customizer.php +++ b/inc/customizer.php @@ -446,6 +446,7 @@ function amadeus_customize_register( $wp_customize ) { array( 'default' => '#618EBA', 'sanitize_callback' => 'sanitize_hex_color', + 'transport' => 'postMessage', ) ); $wp_customize->add_control( diff --git a/js/customizer.js b/js/customizer.js index 206cc3f..4639da2 100644 --- a/js/customizer.js +++ b/js/customizer.js @@ -27,6 +27,13 @@ + //Primary color + wp.customize('primary_color',function( value ) { + value.bind( function( newval ) { + $('a, a:hover, .main-navigation a:hover, .nav-next a:hover, .nav-previous a:hover, .social-navigation li a:hover').css('color', newval ); + $('button, .button, input[type="button"], input[type="reset"], input[type="submit"], .entry-thumb-inner').css('background-color', newval ); + } ); + }); //Social background wp.customize('social_bg',function( value ) { value.bind( function( newval ) {