issue with header_textcolor and customizer
-
Hi!
I’m not sure if I’m posting this in the right category but was not allowed to post in advanced.
I got an issue with header_textcolor not rendering in the customizer.
It does not show me the changes until I save everything, everything else works. On the site it gets updated with the new color etc.It does work if I change the wp_customize header_textcolor to default-text-color instead, but then I get an error in the customizer.
The code I’ve got is :
Customizer.php
function sj_customize_register( $wp_customize ) { $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; } add_action( 'customize_register', 'sj_customize_register' ); /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function sj_customize_preview_js() { wp_enqueue_script( 'sjalvservice_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20151215', true ); } add_action( 'customize_preview_init', 'sj_customize_preview_js' );
And in Customizer.js
// Header text color. wp.customize( 'header_textcolor', function( value ) { value.bind( function( to ) { if ( 'blank' === to ) { $( '.site-title a, .site-description' ).css( { 'clip': 'rect(1px, 1px, 1px, 1px)', 'position': 'absolute' } ); } else { $( '.site-title a, .site-description' ).css( { 'clip': 'auto', 'position': 'relative' } ); $( '.site-title a, .site-description' ).css( { 'color': '#fff'; } ); } } ); } );
Anyone got any insight on this?
Best Regards
- The topic ‘issue with header_textcolor and customizer’ is closed to new replies.