wp_print_font_faces()
Generates and prints font-face styles for given fonts or theme.json fonts.
No Hooks.
Returns
null
. Nothing (null).
Usage
wp_print_font_faces( $fonts );
- $fonts(array[][])
The font-families and their font faces.
Default: empty array
-
...$0(array)
An indexed or associative (keyed by font-family) array of font variations for this font-family. Each font face has the following structure.-
...$0(array)
The font face properties.-
font-family(string)
The font-family property. -
src(string|string[])
The URL(s) to each resource containing the font data. -
font-style(string)
Optional. The font-style property.
Default: 'normal' -
font-weight(string)
Optional. The font-weight property.
Default: '400' -
font-display(string)
Optional. The font-display property.
Default: 'fallback' -
ascent-override(string)
Optional. The ascent-override property. -
descent-override(string)
Optional. The descent-override property. -
font-stretch(string)
Optional. The font-stretch property. -
font-variant(string)
Optional. The font-variant property. -
font-feature-settings(string)
Optional. The font-feature-settings property. -
font-variation-settings(string)
Optional. The font-variation-settings property. -
line-gap-override(string)
Optional. The line-gap-override property. -
size-adjust(string)
Optional. The size-adjust property. - unicode-range(string)
Optional. The unicode-range property.
-
-
-
Changelog
Since 6.4.0 | Introduced. |
wp_print_font_faces() wp print font faces code WP 6.8.1
function wp_print_font_faces( $fonts = array() ) { if ( empty( $fonts ) ) { $fonts = WP_Font_Face_Resolver::get_fonts_from_theme_json(); } if ( empty( $fonts ) ) { return; } $wp_font_face = new WP_Font_Face(); $wp_font_face->generate_and_print( $fonts ); }