From 8d7490ab4cbb2edae444ee43b70f5a1772e40e04 Mon Sep 17 00:00:00 2001 From: LebCit Date: Mon, 3 Dec 2018 21:33:59 +0200 Subject: [PATCH] Localize customize-preview.js --- functions-full-screen-morphing-search.php | 28 +++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/functions-full-screen-morphing-search.php b/functions-full-screen-morphing-search.php index 088d18c..9bc419c 100644 --- a/functions-full-screen-morphing-search.php +++ b/functions-full-screen-morphing-search.php @@ -13,6 +13,34 @@ function full_screen_morphing_search_thumb() { } add_action( 'init', 'full_screen_morphing_search_thumb' ); +/** + * This outputs the javascript needed to automate the live settings preview. + * Also keep in mind that this function isn't necessary unless your settings + * are using 'transport'=>'postMessage' instead of the default 'transport' + * => 'refresh'. + * + * Used by hook: 'customize_preview_init' + */ +function fsmsp_customize_preview_js() { + $handle = 'fsmsp-customize-preview'; + $src = plugins_url( 'assets/js/customize-preview.js', __FILE__ ); + $deps = array( 'customize-preview' ); + $ver = '0.1'; + $in_footer = true; + wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer ); + wp_localize_script( + 'fsmsp-customize-preview', + 'fsmsp_cp', + array( + 'fsmsp_article_icon' => '', + 'fsmsp_category_icon' => '', + 'fsmsp_tag_icon' => '', + 'fsmsp_placeholder_text' => esc_attr( 'Search …' ), + ) + ); +} +add_action( 'customize_preview_init', 'fsmsp_customize_preview_js' ); + /** * Require Kirki. */