function enqueue_custom_styles() { // Enqueue the main stylesheet wp_enqueue_style('main-style', get_stylesheet_uri()); // Add inline CSS add_action('wp_head', 'add_custom_dynamic_css'); } function add_custom_dynamic_css() { global $themeconfig; // Initialize CSS string $css = ''; // Dynamic font-face definitions if ($themeconfig['custom_fonts'] == true && is_array($themeconfig['custom_fonts_array'])) { foreach ($themeconfig['custom_fonts_array'] as $id => $font) { if ($font['font_file_name'] !== "default_font") { $css .= " @font-face { font-family: '{$font['font_family']}'; src: url('".THEMEROOTURL."/css/fonts/{$font['font_file_name']}.eot'); src: url('".THEMEROOTURL."/css/fonts/{$font['font_file_name']}.eot?#iefix') format('embedded-opentype'), url('".THEMEROOTURL."/css/fonts/{$font['font_file_name']}.woff') format('woff'), url('".THEMEROOTURL."/css/fonts/{$font['font_file_name']}.ttf') format('truetype'), url('".THEMEROOTURL."/css/fonts/{$font['font_file_name']}.svg#{$font['svg_id']}') format('svg'); font-weight: {$font['font_weight']}; font-style: {$font['font_style']}; } "; } } } // Theme color and font settings $themecolor1 = isset($_COOKIE['theme_color1']) ? $_COOKIE['theme_color1'] : get_theme_option("theme_color1"); $css .= " /* Basic Font Setup */ * { font-family: '" . get_theme_option("main_content_font") . "', Helvetica, sans-serif; } /* Headings Font Family */ h1, h2, h3, h4, h5, h6, h1 span, h2 span, h3 span, h4 span, h5 span, h6 span, h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { font-family: '" . get_theme_option("text_headers_font") . "', sans-serif!important; } /* Font Settings for Elements */ p, td, div, blockquote p { font-size: " . get_theme_option("main_content_font_size") . "; line-height: " . get_theme_option("main_content_line_height") . "; } /* Main Theme Color */ a, a:hover, .highlighted_colored { color: #" . $themecolor1 . "; } "; // Output all the dynamic CSS echo ''; } add_action('wp_enqueue_scripts', 'enqueue_custom_styles');