public_html/wp-content/themes/LocalTwo/core/customizer/includes/class-kirki-scripts.php
/**
	* Try to automatically generate the script necessary for postMessage to work.
	* Something like this will have to be added to the control arguments:
	*
	* 'transport' => 'postMessage',
	* 'js_vars'   => array(
	* 		'element'  => 'body',
	* 		'type'     => 'css',
	* 		'property' => 'color',
	* 	),
	*
	*/
Try to automatically generate the script necessary for postMessage to work.
Something like this will have to be added to the control arguments.


Try to automatically generate the script necessary for postMessage to work . Something like this will have to be added to the control arguments .
function postmessage() {
		global $kirki;
		$controls = $kirki->get_controls();
		$script = '';
		foreach ( $controls as $control ) {
			if ( isset( $control['transport']  ) && isset( $control['js_vars'] ) && 'postMessage' == $control['transport'] ) {
				$script .= '<script type="text/javascript">jQuery(document).ready(function( $ ) {';
				$script .= 'wp.customize("' . $control['setting'] . '",function( value ) {';
				if ( isset( $control['js_vars']['type'] ) && 'css' == $control['js_vars']['type'] ) {
					$script .= 'value.bind(function(to) {';
					$script .= '$("' . $control['js_vars']['element'] . '").css("' . $control['js_vars']['property'] . '", to ? to : "" );';
					$script .= '});';
				}
				$script .= '});});</script>';
			}
		}
		echo $script;
	}
function postmessage ( ) { global $ kirki ; $ controls = $ kirki -> get_controls ( ) ; $ script = '' ; foreach ( $ controls as $ control ) { if ( isset ( $ control [ 'transport' ] ) && isset ( $ control [ 'js_vars' ] ) && 'postMessage' == $ control [ 'transport' ] ) { $ script .= '<script type="text/javascript">jQuery(document).ready(function( $ ) {' ; $ script .= 'wp.customize("' . $ control [ 'setting' ] . '",function( value ) {' ; if ( isset ( $ control [ 'js_vars' ] [ 'type' ] ) && 'css' == $ control [ 'js_vars' ] [ 'type' ] ) { $ script .= 'value.bind(function(to) {' ; $ script .= '$("' . $ control [ 'js_vars' ] [ 'element' ] . '").css("' . $ control [ 'js_vars' ] [ 'property' ] . '", to ? to : "" );' ; $ script .= '});' ; } $ script .= '});});</script>' ; } } echo $ script ; }
Try to automatically generate the script necessary for postMessage to work.
Try to automatically generate the script necessary for postMessage to work .