/** * Array of Google Font options * * @since 2.1.0 */ function vcex_fonts_array() { $array = array(esc_html__('Default', 'total') => ''); $std_fonts = wpex_standard_fonts(); $array = array_merge($array, $std_fonts); if ($google_fonts = wpex_google_fonts_array()) { $array = array_merge($array, $google_fonts); } return apply_filters('vcex_google_fonts_array', $array); }
/** * Array of Google Font options * * @since 2.1.0 */ function vcex_fonts_array() { $array = array(__('Default', 'wpex') => ''); $std_fonts = wpex_standard_fonts(); $array = array_merge($array, $std_fonts); $google_fonts = wpex_google_fonts_array(); $array = array_merge($array, $google_fonts); $array = apply_filters('vcex_google_fonts_array', $array); return $array; }
public function render_content() { // Get current value $this_val = $this->value(); ?> <label> <span class="customize-control-title"><?php echo esc_html($this->label); ?> </span> <select <?php $this->link(); ?> style="width:100%;"> <option value="" <?php if (!$this_val) { echo 'selected="selected"'; } ?> ><?php _e('Default', 'wpex'); ?> </option> <?php // Add custom fonts from child themes if (function_exists('wpex_add_custom_fonts')) { $fonts = wpex_add_custom_fonts(); if ($fonts && is_array($fonts)) { ?> <optgroup label="<?php _e('Custom Fonts', 'wpex'); ?> "> <?php foreach ($fonts as $font) { ?> <option value="<?php echo $font; ?> " <?php if ($font == $this_val) { echo 'selected="selected"'; } ?> ><?php echo $font; ?> </option> <?php } ?> </optgroup> <?php } } ?> <optgroup label="<?php _e('Standard Fonts', 'wpex'); ?> "> <?php // Get standard font options $std_fonts = wpex_standard_fonts(); // Loop through font options and add to select foreach ($std_fonts as $font) { ?> <option value="<?php echo $font; ?> " <?php selected($font, $this_val); ?> ><?php echo $font; ?> </option> <?php } ?> </optgroup> <optgroup label="<?php _e('Google Fonts', 'wpex'); ?> "> <?php // Get font options $google_fonts = wpex_google_fonts_array($google_fonts); // Loop through font options and add to select foreach ($google_fonts as $font) { ?> <option value="<?php echo $font; ?> " <?php selected($font, $this_val); ?> ><?php echo $font; ?> </option> <?php } ?> </optgroup> </select> </label> <?php }