/** * Render Content */ public function render_content() { if (empty($this->choices)) { return; } $name = '_customize-radio-' . $this->id; if (!empty($this->label)) { ?> <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 } foreach ($this->choices as $value => $label) { ?> <label> <input type="radio" value="<?php echo esc_attr($value); ?> " name="<?php echo esc_attr($name); ?> " <?php $this->link(); checked($this->value(), $value); ?> /> <span style="font-size:20px;line-height:35px;font-family:<?php echo esc_attr(tamatebako_get_font_family($value)); ?> ;"><?php echo esc_html($label); ?> </span><br/> </label> <?php } }
/** * Print CSS to Modify Font */ function tamatebako_fonts_print_style() { /* CSS */ $css = ''; /* Config */ $config = tamatebako_fonts_config(); /* Foreach setting */ foreach ($config as $section => $section_data) { /* Get font saved. */ $font = get_theme_mod($section, $section_data['default']); /* Only add if it's not the default. */ if ($font) { $target_element = $section_data['target']; $font_family = tamatebako_get_font_family($font); $css .= "{$target_element}{font-family:{$font_family};}"; } } /* PRINT CSS */ if (!empty($css)) { echo "\n" . '<style type="text/css" id="tamatebako-custom-fonts-rules-css">' . trim($css) . '</style>' . "\n"; } }
/** * Ajax Callback */ function tamatebako_fonts_mce_css_ajax_callback() { /* Var */ $css = ''; $settings = tamatebako_fonts_mce_setting(); $config = tamatebako_fonts_config(); foreach ($settings as $setting) { $font = get_theme_mod($setting, $config[$setting]['default']); $target_element = $config[$setting]['target']; $font_family = tamatebako_get_font_family($font); $css .= "{$target_element}{font-family:{$font_family};}"; } header('Content-type: text/css'); echo $css; die; }