Kirki_Fonts::get_google_fonts PHP Method

get_google_fonts() public static method

Return an array of all available Google Fonts.
public static get_google_fonts ( ) : array
return array All Google Fonts.
        public static function get_google_fonts()
        {
            if (null === self::$google_fonts || empty(self::$google_fonts)) {
                $fonts = (include wp_normalize_path(Kirki::$path . '/includes/webfonts.php'));
                $google_fonts = array();
                if (is_array($fonts)) {
                    foreach ($fonts['items'] as $font) {
                        $google_fonts[$font['family']] = array('label' => $font['family'], 'variants' => $font['variants'], 'subsets' => $font['subsets'], 'category' => $font['category']);
                    }
                }
                self::$google_fonts = apply_filters('kirki/fonts/google_fonts', $google_fonts);
            }
            return self::$google_fonts;
        }

Usage Example

Ejemplo n.º 1
0
 /**
  * The class constructor.
  */
 private function __construct()
 {
     $config = apply_filters('kirki/config', array());
     // If we have set $config['disable_google_fonts'] to true then do not proceed any further.
     if (isset($config['disable_google_fonts']) && true === $config['disable_google_fonts']) {
         return;
     }
     // Populate the array of google fonts.
     $this->google_fonts = Kirki_Fonts::get_google_fonts();
     // Enqueue link.
     add_action('wp_enqueue_scripts', array($this, 'enqueue'), 105);
 }
All Usage Examples Of Kirki_Fonts::get_google_fonts