[Support request] Adding opens sans hebrew and open sans condensed hebrew

Home Forums Support [Support request] Adding opens sans hebrew and open sans condensed hebrew

Home Forums Support Adding opens sans hebrew and open sans condensed hebrew

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #933129
    Lisa

    **** Amendment – The font is now showing in the GeneratePress font list. but this code is showing on the front end
    @import url(//fonts.googleapis.com/earlyaccess/opensanshebrew.css); (this is showing on the front end)

    ALSO – how do I add the second font – Open sans condensed Hebrew?
    ****

    I am struggling to add the font Open Sans Hebrew and Open Sans Condensed Hebrew to the GeneratePress theme.
    This font does appear in Elementor font list but not in the GeneratePress font list.
    I found several references to this in the forum from 2 years ago but was unable to decipher the correct way to do it.
    This font still sits in ‘Early Access’ and not in the main google fonts library.

    This is what I have added to Simple CSS.

    @import url(//fonts.googleapis.com/earlyaccess/opensanshebrew.css); (this is showing on the front end)
    body {font-family: ‘Open Sans Hebrew’, sans-serif;}

    and this code to “Code Snippets’
    add_filter( ‘generate_typography_customize_list’, ‘tu_add_google_fonts’ );
    function tu_add_google_fonts( $fonts ) {
    $fonts[ ‘open_sans_hebrew’ ] = array(
    ‘name’ => ‘Open Sans Hebrew’,
    ‘variants’ => array( ‘400’, ‘500’, ‘700’ ),
    ‘category’ => ‘serif’
    );

    return $fonts;
    }

    This is not working for me.

    #933320
    Tom
    Lead Developer
    Lead Developer

    If the font isn’t in the Google Fonts library, you’ll want to use this filter:

    add_filter( 'generate_typography_default_fonts', function( $fonts ) {
        $fonts[] = 'Open Sans Hebrew';
    
        return $fonts;
    } );

    This will stop GP from requesting it from Google.

    I’m seeing the @import code twice in your source. Once in Simple CSS, which is correct. The other is outside of any CSS areas, which is why you’re seeing it on the site. Has it been added twice?

    #934322
    Lisa

    Tom HI
    Re. the code showing on the front end… Yes by mistake I had it first in the GP hooks – now deleted.
    With regard to the code that you gave me.

    I already have this in code snippets.
    _____________________________________________________________
    add_filter( ‘generate_typography_customize_list’, ‘tu_add_google_fonts’ );
    function tu_add_google_fonts( $fonts ) {
    $fonts[ ‘open_sans_hebrew’ ] = array(
    ‘name’ => ‘Open Sans Hebrew’,
    ‘variants’ => array( ‘400’, ‘500’, ‘700’ ),
    ‘category’ => ‘serif’
    );

    return $fonts;
    }
    ______________________________________________________

    is this wrong what I already have here?
    HOw do I add the second font to this code?

    Lisa

    #934449
    Tom
    Lead Developer
    Lead Developer

    Yes, that’s not the correct filter.

    Instead, do this:

    add_filter( 'generate_typography_default_fonts', function( $fonts ) {
        $fonts[] = 'Open Sans Hebrew';
        $fonts[] = 'Second Font Name Here';
    
        return $fonts;
    } );

    That will add the fonts to the default/system fonts area in your dropdown (instead of Google fonts).

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