[Resolved] Multiple local fonts – only one works

Home Forums Support [Resolved] Multiple local fonts – only one works

Home Forums Support Multiple local fonts – only one works

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #615206
    Kommunikationsbeauftragter

    Hi,
    Im trying to get multiple fonts to work for hours now. The problem I have, is that if I add multiple local fonts the way described here: https://generatepress.com/forums/topic/custom-fonts-how-to-add-multiple-fonts-and-how-to-limit-the-weights/
    only the first font declared in my functions.php works.

    <?php
    /**
     * GeneratePress child theme functions and definitions.
     *
     * Add your custom PHP in this file. 
     * Only edit this file if you have direct access to it on your server (to fix errors if they happen).
     */
    
    function generatepress_child_enqueue_scripts() {
    	if ( is_rtl() ) {
    		wp_enqueue_style( 'generatepress-rtl', trailingslashit( get_template_directory_uri() ) . 'rtl.css' );
    	}
    }
    
    add_filter( 'generate_typography_default_fonts','tu_add_system_fonts' );
    function tu_add_system_fonts( $fonts ) {
        $fonts[] = 'Lato'; /*only this one ist working*/
        $fonts[] = 'Reem Kufi';
    
        return $fonts;
    }

    They both show up in the typography system fonts dropdown menu, but the second one (reem kufi) doesnt changes the texts look to times new roman. If I change their order in the php(so reem kufi is declared first and then lato) reem kufi works, but the lato font stops to work. Thats why i think there is a problem in my php and not in my css.

    Greetings from Germany

    Elias

    GeneratePress 2.1.3
    GP Premium 1.6.2
    #615655
    Kommunikationsbeauftragter

    Can’t anyone help me?

    #615670
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Can you share the @font-face CSS that you’re using as well?

    You can find updated docs here: https://docs.generatepress.com/article/adding-local-fonts/

    #616283
    Kommunikationsbeauftragter

    Of course ๐Ÿ™‚

    (edit: ive deleted it because it was pointing to sort of an official website. I had a typo in the url pointing to the font)

    This is my css. I have tried it both through the Simple CSS plugin and the child themes style.css. With none of them both fonts worked…

    (Thanks for sharing the documentation. I followed every step of it (before post 1) but I can’ get both fonts to work at the same time)

    #616338
    Tom
    Lead Developer
    Lead Developer

    Can you confirm that the URL to the files are correct? I’m seeing these console errors on your website: https://www.screencast.com/t/1JFU4LzX1d

    #616469
    Kommunikationsbeauftragter

    Thanks for your help! It was just a simple typo in the URL (wp_content instead of wp-content and a missing /themes inside…)

    Elias

    #616839
    Tom
    Lead Developer
    Lead Developer
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.