. * * @access public * @since 3.0.28 * @return void */ public function the_style() { // Get an array of all fields. $fields = Kirki::$fields; echo ''; } /** * Enqueues the script that handles postMessage * and adds variables to it using the wp_localize_script function. * The rest is handled via JS. * * @access public * @since 3.0.28 * @return void */ public function postmessage() { wp_enqueue_script( 'kirki_auto_css_vars', trailingslashit( Kirki::$url ) . 'modules/css-vars/script.js', array( 'jquery', 'customize-preview' ), KIRKI_VERSION, true ); $fields = Kirki::$fields; $data = array(); foreach ( $fields as $field ) { if ( isset( $field['transport'] ) && 'postMessage' === $field['transport'] && isset( $field['css_vars'] ) && ! empty( $field['css_vars'] ) ) { $data[] = $field; } } wp_localize_script( 'kirki_auto_css_vars', 'kirkiCssVarFields', $data ); } }