Site logo

Archived topic

Add new font

13 replies · Started by Maria Andrea on August 30, 2018

Viewing posts 1–14 of 14

Hello, I would like to add a new font. I am working my page with Elementor. I am using Grand Hotel font in all pages and its is working; but, when I use it with woocommerce it doesn´t work. I realized that this type of font is not included in Generate press. I need your help to add Gran Hotel font.

Thanks so much

Maria Andrea

Thanks so much for your answer. I made the different steps given in the link you shared me. However, I couldn´t include the font in the customize list. I don´t know where to copy and paste the following in order to include the font in the list:

add_filter( 'generate_typography_default_fonts', 'tu_add_local_fonts' );
function tu_add_local_fonts( $fonts ) {
$fonts[] = 'Grand Hotel';
return $fonts;
}

Grand Hotel is the font I wanted to add.

When I copy and paste in the CSS additional, its appear an error (X expected RBRACE at line 38, col 1.), (X expected RBRACE at line 39, col 10.) (X expected RBRACE at line 41, col 12.)

Thanks so much for your help

Maria Andrea

I could not add the php with Code snippets. Do you have a video to add a new font I could not include the font in the customize list. The font is showed in all pages except in the shop and product pages.

I hope you can help me

Maria Andrea

Hi there,

Grand Hotel is a Google font, so you'd need to use this function:

add_filter( 'generate_typography_customize_list', function( $fonts ) {
	$fonts[ 'grand_hotel' ] = array( 
		'name' => 'Grand Hotel',
		'variants' => array(),
		'category' => 'cursive'
	);
	
	return $fonts;
} );

That should add the font to the very bottom of the Google Fonts section.

Let me know :)

Hello,

Following your instructions I tried to include the paragraph in the php file, but it did not allow me. I am sending a picture of what I tried to do.

https://drive.google.com/open?id=1UOzME1SobBcN9plMrNHO0hYHfNB3xDAv

Is it possible that I give you a temporary log in in order to fix it or what can I do? I feel frustrated because my web is almost done except with this problem of the font and I need to publish it.

Thanks,

Maria Andrea

What does that message say? It's an image so I couldn't copy and paste into Google translate.

I tested Tom's code above and successfully added the font.

Let me know :)

The message says:

No ha sido posible comunicar con el sitio para comprobar los errores fatales, así que el cambio de PHP se ha revertido. Tendrás que subir el cambio del archivo PHP por otros medios, como por ejemplo usando SFTP.

It has not been possible to communicate with the site to check for fatal errors, so the PHP change has been reversed. You will have to upload the PHP file change by other means, such as using SFTP

Best regard,

Maria Andrea

That's strange, maybe your host is using an old version of PHP.

Try this instead:

add_filter( 'generate_typography_customize_list', 'tu_add_custom_g_font' );
function tu_add_custom_g_font( $fonts ) {
	$fonts[ 'grand_hotel' ] = array( 
		'name' => 'Grand Hotel',
		'variants' => array(),
		'category' => 'cursive'
	);
	
	return $fonts;
}

That's really strange. It's hard to know what's going on without a more detailed error message. It may be worth contacting your hosting company to ask them to check the error_log file. It should contain a more detailed error message that will allow us to debug further.

You could also try a plugin like this instead if your child theme, just to test: https://wordpress.org/plugins/code-snippets/

Hello:

I just wrote my hosting Webempresa. I tried with Code snippets. But i didn´t work.Once I have an answer I will write you.

Thanks

Maria Andrea

Sounds good, I'll be here :)

This archived topic is closed to new replies.