-
Notifications
You must be signed in to change notification settings - Fork 0
Adding Font Family
Henner R Setyono edited this page Apr 4, 2020
·
1 revision
Specify it in theme support like below:
add_action( 'after_setup_theme', function() {
if( class_exists( 'Custy' ) ) {
$font_dir = get_stylesheet_directory_uri() . '/assets/fonts';
add_theme_support( 'custy-fonts', [
'Roboto' => [
'400' => $font_dir . '/roboto-regular.woff',
'400i' => $font_dir . '/roboto-italic.woff',
'700' => $font_dir . '/roboto-bold.woff',
],
'Miriam Libre' => [
'300' => $font_dir . '/miriam-libre-regular.woff',
'700' => $font_dir . '/miriam-libre-bold.woff',
],
] );
}
} );It will automagically do these:
- Echo
@font-facedeclaration in frontend's<head>. - Echo
@font-facedeclaration in block editor's<head>and some styling to override its default font family. - Append the font into the dropdown of Customizer's typography field.
Where to apply the code above?
- The option snippet is for New Section Filter
- The value format is for Default Value Filter
Learn more: