/** * This function renders the control's content. */ public function render_content() { ?> <div class="sds-theme-options-web-fonts-wrap customize-sds-theme-options-web-fonts-wrap"> <span class="customize-control-title"><?php echo esc_html($this->label); ?> </span> <?php if (!empty($this->description)) { ?> <span class="description customize-control-description"><?php echo $this->description; ?> </span> <?php } ?> <div class="sds-theme-options-web-font sds-theme-options-web-font-default"> <label> <input type="radio" id="sds_theme_options_web_font_default" name="sds_theme_options[web_font]" <?php checked(!$this->value() || $this->value() === 'default'); ?> value="default" <?php $this->link(); ?> /> <div class="sds-theme-options-web-font-selected"> </div> </label> <span class="sds-theme-options-web-font-label-default"><?php _e('Default', 'baton'); ?> </span> </div> <?php foreach (sds_web_fonts() as $name => $atts) { $css_name = strtolower(str_replace(array('+', ':'), '-', $name)); ?> <div class="sds-theme-options-web-font sds-theme-options-web-font-<?php echo $css_name; ?> " style="<?php echo isset($atts['css']) && !empty($atts['css']) ? $atts['css'] : false; ?> "> <label> <input type="radio" id="sds_theme_options_web_font_name_<?php echo $css_name; ?> " name="sds_theme_options[web_font]" <?php checked($this->value() === $name); ?> value="<?php echo $name; ?> " <?php $this->link(); ?> /> <div class="sds-theme-options-web-font-selected"> </div> </label> <span class="sds-theme-options-web-font-label"><?php echo isset($atts['label']) ? $atts['label'] : false; ?> </span> <span class="sds-theme-options-web-font-preview"><?php _e('Grumpy wizards make toxic brew for the evil Queen and Jack.', 'baton'); ?> </span> </div> <?php } ?> </div> <?php }
function sds_wp_head() { global $sds_theme_options, $is_IE; // Web Fonts if (function_exists('sds_web_fonts') && !empty($sds_theme_options['web_font'])) { $web_fonts = sds_web_fonts(); $selected_web_font = array_key_exists($sds_theme_options['web_font'], $web_fonts) ? $web_fonts[$sds_theme_options['web_font']] : false; if (!empty($selected_web_font) && isset($selected_web_font['css'])) { ?> <style type="text/css"> <?php echo apply_filters('sds_web_font_css_selector', 'html, body'); ?> { <?php echo $selected_web_font['css']; ?> } </style> <?php } } // HTML5 Shiv (IE only, conditionally for less than IE9) if ($is_IE) { echo '<!--[if lt IE 9]><script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->'; } }
/** * This function returns a formatted list of Google Web Font families for use when enqueuing styles. */ public function get_google_font_families_list() { if (function_exists('sds_web_fonts')) { $web_fonts = sds_web_fonts(); $web_fonts_count = count($web_fonts); $google_families = ''; if (!empty($web_fonts) && is_array($web_fonts)) { foreach ($web_fonts as $name => $atts) { // Google Font Name $google_families .= $name; if ($web_fonts_count > 1) { $google_families .= '|'; } } // Trim last | when multiple fonts are set if ($web_fonts_count > 1) { $google_families = substr($google_families, 0, -1); } } return $google_families; } return false; }