Esempio n. 1
0
 function et_builder_enqueue_font($font_name)
 {
     $fonts = et_builder_get_fonts();
     $websafe_fonts = et_builder_get_websafe_fonts();
     $protocol = is_ssl() ? 'https' : 'http';
     // Skip enqueueing if font name is not found. Possibly happen if support for particular font need to be dropped
     if (!array_key_exists($font_name, $fonts)) {
         return;
     }
     // Skip enqueueing for websafe fonts
     if (array_key_exists($font_name, $websafe_fonts)) {
         return;
     }
     if (isset($fonts[$font_name]['parent_font'])) {
         $font_name = $fonts[$font_name]['parent_font'];
     }
     $font_character_set = $fonts[$font_name]['character_set'];
     $query_args = array('family' => sprintf('%s:%s', str_replace(' ', '+', $font_name), apply_filters('et_builder_set_styles', $fonts[$font_name]['styles'], $font_name)), 'subset' => apply_filters('et_builder_set_character_set', $font_character_set, $font_name));
     $font_name_slug = sprintf('et-gf-%1$s', strtolower(str_replace(' ', '-', $font_name)));
     wp_enqueue_style($font_name_slug, esc_url(add_query_arg($query_args, "{$protocol}://fonts.googleapis.com/css")), array(), null);
 }
Esempio n. 2
0
 function et_builder_get_fonts($settings = array())
 {
     $defaults = array('prepend_standard_fonts' => true);
     $settings = wp_parse_args($settings, $defaults);
     $fonts = $settings['prepend_standard_fonts'] ? array_merge(et_builder_get_websafe_fonts(), et_builder_get_google_fonts()) : array_merge(et_builder_get_google_fonts(), et_builder_get_websafe_fonts());
     return $fonts;
 }