Site logo

Archived topic

New typography manager : impossible to select a custom font added with code

6 replies · Started by Jean-Pol on September 26, 2021

Viewing posts 1–7 of 7

Hello,
I add 2 custom fonts with code in style.css and function.php.
I'm able to choose the fonts in the previous typography menu, but impossible to add them in the new typography manager : not listed.

Thanks !

Here the code :
in style.css :

@font-face {
    font-family: 'Honeysail';
    font-style: normal;
    font-weight: 400;
    src: url('https://mysite.com/wp-content/themes/generatepress_child/honeysail.woff2') format('woff2'),
         url('https://mysite.com/wp-content/themes/generatepress_child/honeysail.woff') format('woff');
}

@font-face {
    font-family: 'Dreamy-Notes-Sans';
    font-style: normal;
    font-weight: 400;
    src: url('https://mysite.com/wp-content/themes/generatepress_child/Dreamy-Notes-Sans.woff2') format('woff2'),
         url('https://mysite.com/wp-content/themes/generatepress_child/Dreamy-Notes-Sans.woff') format('woff');
}

and in function.php


function generatepress_child_enqueue_scripts() {
	if ( is_rtl() ) {
		wp_enqueue_style( 'generatepress-rtl', trailingslashit( get_template_directory_uri() ) . 'rtl.css' );
	}
}
add_action( 'wp_enqueue_scripts', 'generatepress_child_enqueue_scripts', 100 );

add_filter( 'generate_typography_default_fonts', function( $fonts ) {
    $fonts[] = 'Honeysail';
    $fonts[] = 'Dreamy-Notes-Sans';
    return $fonts;
} );

The font files : in generatepress_child directory

All this worked before I check the new typography manager checkbox.

Hi there,

in the Font Manager, just enter the Name of your local Font in the field provided, make sure not to check its a Google Font.

Thanks, Elvin and David !

Works as expected :-)

Jean-Pol

Resolved !

Glad to hear that!

This archived topic is closed to new replies.