[Support request] Add new font

Home Forums Support [Support request] Add new font

Home Forums Support Add new font

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #664238
    Maria Andrea

    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

    #664263
    David
    Staff
    Customer Support
    #664443
    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

    #664531
    Leo
    Staff
    Customer Support

    The filter part should be added with one of these methods:
    https://docs.generatepress.com/article/adding-php/

    Code snippets plugin is the easiest if you aren’t using a child theme.

    #675911
    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

    #675924
    Tom
    Lead Developer
    Lead Developer

    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 🙂

    #678761
    Maria Andrea

    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

    #678810
    Leo
    Staff
    Customer Support

    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 🙂

    #678819
    Maria Andrea

    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

    #678837
    Tom
    Lead Developer
    Lead Developer

    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;
    }
    #678840
    Maria Andrea

    Hello,

    My host is Webempresa.

    I just tried, and appears the same error

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

    Best regard,

    Maria Andrea

    #678870
    Tom
    Lead Developer
    Lead Developer

    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/

    #679567
    Maria Andrea

    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

    #679759
    Tom
    Lead Developer
    Lead Developer

    Sounds good, I’ll be here 🙂

Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.