esc_html(get_theme_mod('c9_heading_font', 'Sen:wght@400,700,800')), 'c9_subheading_font' => esc_html(get_theme_mod('c9_subheading_font', 'Sen:wght@400,700,800')), 'c9_body_font' => esc_html(get_theme_mod('c9_body_font', 'Sen:wght@400,700,800')), 'c9_default_font' => esc_js($c9_fonts) ]; $font_list = []; foreach (['c9_heading_font', 'c9_subheading_font', 'c9_body_font'] as $f) { if (!empty($font_array[$f]) && !in_array($font_array[$f], $font_list)) $font_list[] = $font_array[$f]; } $font_array['c9_font_list'] = apply_filters('c9_google_fonts', $font_list); // Use the localize function to localize the script and continue with the code wp_localize_script('c9-typography-script', 'c9SelectedFonts', $font_array); // Enqueued script with the data we pulled from earlier selections wp_enqueue_script('c9-typography-script'); require_once(get_template_directory() . '/assets/fonts/class-c9fontstyles.php'); ob_start(); C9FontStyles::render($font_array); $font_css = ob_get_clean(); $fonts_minified = C9FontStyles::minify_css($font_css); wp_add_inline_style('c9-styles', $fonts_minified); } } add_action('enqueue_block_editor_assets', 'c9_editor_style');