/** * File customizer.js. * * Theme Customizer enhancements for a better user experience. * * Contains handlers to make Theme Customizer preview reload changes asynchronously. */ ( function( $ ) { // Site title and description. wp.customize( 'blogname', function( value ) { value.bind( function( to ) { $( '.site-title a' ).text( to ); } ); } ); wp.customize( 'blogdescription', function( value ) { value.bind( function( to ) { $( '.site-description' ).text( to ); } ); } ); // Header text color. wp.customize( 'header_textcolor', function( value ) { value.bind( function( to ) { if ( 'blank' === to ) { $( '.site-title, .site-description' ).css( { 'clip': 'rect(1px, 1px, 1px, 1px)', 'position': 'absolute' } ); } else { $( '.site-title, .site-description' ).css( { 'clip': 'auto', 'position': 'relative' } ); $( '.site-title a, .site-description' ).css( { 'color': to } ); } } ); } ); wp.customize( 'background_color', function( value ) { value.bind( function( to ) { if ('#ffffff' === to) { $('body.home').removeClass('custom-background'); }else{ $('body.home').addClass('custom-background'); } } ); } ); wp.customize( 'background_image', function( value ) { value.bind( function( to ) { if ('' === to || null === to || 'undefined' === to) { $('body.home').removeClass('custom-background'); }else{ $('body.home').addClass('custom-background'); } } ); } ); /*Primary Color Title Border*/ wp.customize('primary_bg_color', function(value) { // When the value changes. value.bind(function(newval) { // Generate the CSS. var cssContent = `.author-portfolio-standard-post__post-title a h2, .author-portfolio-standard-post__post-title a h3, ul.recent-post-widget li .recent-widget-content h2{ background-image: linear-gradient(to right, ${newval} 0%, ${newval} 100%) }`; jQuery('.author-portfolio-standard-post__post-title a h2, .author-portfolio-standard-post__post-title a h3, ul.recent-post-widget li .recent-widget-content h2').css({ 'background-image': 'linear-gradient(to right, ' + newval + ' 0%, ' + newval + ' 100%)', }); }); }); } )( jQuery );