Site logo

Archived topic

Code snippet for adding a third google font

1 reply · Started by Laura on June 26, 2020

Viewing posts 1–2 of 2

Hi Team GP

Following your documentation, I managed to add INTER and QUESTRIAL google fonts using Code snippets plugin.

Using the same code, I have had no success with a third free google font Martel sans, however.

here is the code:

add_filter( 'generate_typography_customize_list', 'tu_add_google_fonts' );
function tu_add_google_fonts( $fonts ) {
$fonts[ 'Martel_Sans' ] = array(
'name' => 'Martel Sans',
'variants' => array( '200', '300', '400', '500', '600'),
'category' => 'sans-serif'
);

return $fonts;
}

Adjusting the same code with Martel+Sans did not work either.

Please advise
Many thanks

Hi there,

try this:

add_filter( 'generate_typography_customize_list', 'martel_sans_add_google_fonts' );
function martel_sans_add_google_fonts( $fonts ) {
	$fonts[ 'martel_sans' ] = array( 
		'name' => 'Martel Sans',
		'variants' => array( '200', '300', '400', '500', '600' ),
		'category' => 'sans-serif'
	);

	return $fonts;
}
This archived topic is closed to new replies.