WC_Settings_Emails::get_custom_fonts()publicWC 1.0

Get custom fonts for emails.

Method of the class: WC_Settings_Emails{}

No Hooks.

Return

null. Nothing (null).

Usage

$WC_Settings_Emails = new WC_Settings_Emails();
$WC_Settings_Emails->get_custom_fonts();

WC_Settings_Emails::get_custom_fonts() code WC 9.7.1

public function get_custom_fonts() {
	$custom_fonts = array();
	if ( wc_current_theme_is_fse_theme() && class_exists( 'WP_Font_Face_Resolver' ) ) {
		$theme_fonts = WP_Font_Face_Resolver::get_fonts_from_theme_json();
		if ( count( $theme_fonts ) > 0 ) {
			foreach ( $theme_fonts as $font ) {
				if ( ! empty( $font[0]['font-family'] ) ) {
					$custom_fonts[ $font[0]['font-family'] ] = $font[0]['font-family'];
				}
			}
		}
	}
	ksort( $custom_fonts );

	return $custom_fonts;
}