'postMessage' instead of the default 'transport' * => 'refresh' * * @return void */ public static function live_preview() { /* Live Preview using Javascript and postMessage Transport */ } /** * Enqueue customizer scripts. * * @return void */ public function enqueue_scripts() { $deps = array( 'jquery', 'wp-color-picker' ); wp_enqueue_script( 'chosen', get_template_directory_uri() . '/assets/plugins/chosen/chosen.jquery.min.js', $deps, '1.0.0', true ); wp_enqueue_script( 'themeoo-customizer', get_template_directory_uri() . '/inc/customizer/assets/js/customizer.min.js', array(), '1.0.0', true ); wp_localize_script( 'themeoo-customizer', 'themeooCustomizerFontsL10n', themeoo_get_all_fonts() ); wp_enqueue_style( 'chosen', get_template_directory_uri() . '/assets/plugins/chosen/chosen.min.css', array(), '1.0.0' ); wp_enqueue_style( 'themeoo-customizer', get_template_directory_uri() . '/inc/customizer/assets/css/customizer.css', array(), '1.0.0' ); } /** * Enqueue fonts. * * @return void */ public function enqueue_fonts() { $fonts = array( 'typography_global_font_family' => themeoo_get_mod( 'typography_global_font_family' ), 'typography_global_font_variant' => themeoo_get_mod( 'typography_global_font_variant' ), 'typography_heading_h1_font_family' => themeoo_get_mod( 'typography_heading_h1_font_family' ), 'typography_heading_h1_font_variant' => themeoo_get_mod( 'typography_heading_h1_font_variant' ), 'typography_heading_h2_font_family' => themeoo_get_mod( 'typography_heading_h2_font_family' ), 'typography_heading_h2_font_variant' => themeoo_get_mod( 'typography_heading_h2_font_variant' ), 'typography_heading_h3_font_family' => themeoo_get_mod( 'typography_heading_h3_font_family' ), 'typography_heading_h3_font_variant' => themeoo_get_mod( 'typography_heading_h3_font_variant' ), 'typography_heading_h4_font_family' => themeoo_get_mod( 'typography_heading_h4_font_family' ), 'typography_heading_h4_font_variant' => themeoo_get_mod( 'typography_heading_h4_font_variant' ), 'typography_heading_h5_font_family' => themeoo_get_mod( 'typography_heading_h5_font_family' ), 'typography_heading_h5_font_variant' => themeoo_get_mod( 'typography_heading_h5_font_variant' ), 'typography_heading_h6_font_family' => themeoo_get_mod( 'typography_heading_h6_font_family' ), 'typography_heading_h6_font_variant' => themeoo_get_mod( 'typography_heading_h6_font_variant' ), 'typography_menu_font_family' => themeoo_get_mod( 'typography_menu_font_family' ), 'typography_menu_font_variant' => themeoo_get_mod( 'typography_menu_font_variant' ), 'typography_menu_sub_font_family' => themeoo_get_mod( 'typography_menu_sub_font_family' ), 'typography_menu_sub_font_variant' => themeoo_get_mod( 'typography_menu_sub_font_variant' ), 'typography_site_title_font_family' => themeoo_get_mod( 'typography_site_title_font_family' ), 'typography_site_title_font_variant' => themeoo_get_mod( 'typography_site_title_font_variant' ), 'typography_site_tagline_font_family' => themeoo_get_mod( 'typography_site_tagline_font_family' ), 'typography_site_tagline_font_variant' => themeoo_get_mod( 'typography_site_tagline_font_variant' ), 'typography_sidebar_title_font_family' => themeoo_get_mod( 'typography_sidebar_title_font_family' ), 'typography_sidebar_title_font_variant' => themeoo_get_mod( 'typography_sidebar_title_font_variant' ), 'typography_sidebar_body_font_family' => themeoo_get_mod( 'typography_sidebar_body_font_family' ), 'typography_sidebar_body_font_variant' => themeoo_get_mod( 'typography_sidebar_body_font_variant' ), 'typography_footer_title_font_family' => themeoo_get_mod( 'typography_footer_title_font_family' ), 'typography_footer_title_font_variant' => themeoo_get_mod( 'typography_footer_title_font_variant' ), 'typography_footer_body_font_family' => themeoo_get_mod( 'typography_footer_body_font_family' ), 'typography_footer_body_font_variant' => themeoo_get_mod( 'typography_footer_body_font_variant' ), 'typography_footer_text_font_family' => themeoo_get_mod( 'typography_footer_text_font_family' ), 'typography_footer_text_font_variant' => themeoo_get_mod( 'typography_footer_text_font_variant' ), ); $used_fonts = array(); $defaults = array_keys( themeoo_get_standard_fonts() ); foreach ( $fonts as $key => $value ) { if ( themeoo_string_ends_with( $key, '_family' ) && ! empty( $value ) && ! in_array( $value, $defaults ) ) { $settings = str_replace( '_family', '_variant', $key ); $variant = themeoo_get_default_mod( $settings, $fonts ); $used_fonts[ $value ] = array_key_exists( $value, $used_fonts ) ? ( strpos( $used_fonts[ $value ], $variant ) !== false ) ? $used_fonts[ $value ] : "$used_fonts[$value],$variant" : "$value:$variant"; } } $protocol = is_ssl() ? 'https' : 'http'; $query_args = array( 'family' => str_replace( ' ', '+', implode( '|', array_values( $used_fonts ) ) ), 'subset' => implode( ',', (array) themeoo_get_mod( 'typography_options_subsets' ) ), ); wp_enqueue_style( 'themeoo_google-fonts', add_query_arg( $query_args, "$protocol://fonts.googleapis.com/css" ), array(), null ); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion } /** * Print customized css. * * @return void */ public static function print_css() { $accent_color = themeoo_get_mod( 'colors_global_accent' ); $accent_shade_color = themeoo_get_mod( 'colors_global_accent_shade' ); $border_color = themeoo_get_mod( 'colors_global_border' ); $title_text = themeoo_get_mod( 'colors_title_text' ); $footer_text = themeoo_get_mod( 'colors_footer_text' ); $footer_link = themeoo_get_mod( 'colors_footer_link' ); $footer_link_hover = themeoo_get_mod( 'colors_footer_link_hover' ); ?>