Astra_Font_Families::get_google_fonts()
Google Fonts used in astra.
Description
Array is generated from the google-fonts.json file.
Return
(Array) Array of Google Fonts.
Source
File: inc/customizer/class-astra-font-families.php
		public static function get_google_fonts() {
			if ( empty( self::$google_fonts ) ) {
				/**
				 * Deprecating the Filter to change the Google Fonts JSON file path.
				 *
				 * @since 2.5.0
				 * @param string $json_file File where google fonts json format added.
				 * @return array
				 */
				$google_fonts_file = apply_filters( 'astra_google_fonts_php_file', ASTRA_THEME_DIR . 'inc/google-fonts.php' );
				if ( ! file_exists( $google_fonts_file ) ) {
					return array();
				}
				$google_fonts_arr = include $google_fonts_file;// phpcs:ignore: WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
				foreach ( $google_fonts_arr as $key => $font ) {
					$name = key( $font );
					foreach ( $font[ $name ] as $font_key => $single_font ) {
						if ( 'variants' === $font_key ) {
							foreach ( $single_font as $variant_key => $variant ) {
								if ( 'regular' == $variant ) {
									$font[ $name ][ $font_key ][ $variant_key ] = '400';
								}
							}
						}
						self::$google_fonts[ $name ] = array_values( $font[ $name ] );
					}
				}
			}
			return apply_filters( 'astra_google_fonts', self::$google_fonts );
		}
			Expand full source code Collapse full source code View on Trac
Changelog
| Version | Description | 
|---|---|
| 1.0.19 | Introduced. |