[Resolved] Adobe fonts

Home Forums Support [Resolved] Adobe fonts

Home Forums Support Adobe fonts

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #1089522
    _blank

    Hi
    Is there safe way of adding adobe typekit fonts, i’ve tried this method from your tube and it crashes my test site.

    Thanks
    Scott

    #1089565
    David
    Staff
    Customer Support

    Hi there,

    that method is the correct way of adding the CSS version of typekit.
    The only reason a crash may occur is if there is an error in your Code Snippet. Does it report any particular error and can you share the code you’re adding?

    #1089585
    _blank

    Hi David,
    I’m using Desktop Server locally and got this message after activating it.

    Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘tu_add_typefit_fonts’ not found or invalid function name in /Users/designmini/Documents/Websites/www.generateblueprint-nov2019.dev.cc/wp-includes/class-wp-hook.php on line 288

    Thanks
    Scott

    #1089594
    David
    Staff
    Customer Support

    Can you share the code you have added?

    #1089597
    _blank

    Yeah sure

    add_filter( 'generate_typography_default_fonts', 'tu_add_typefit_fonts' );
    function tu_add_typekit_fonts( $fonts ) {
        $fonts[] = 'miller-text'; 
        $fonts[] = 'interstate'; 
        return $fonts;
    };
    #1089653
    David
    Staff
    Customer Support

    Hmmm can’t see any reason why that wouldn’t work – try an anonymous function instead:

    add_filter( 'generate_typography_default_fonts', function( $fonts ) {
        $fonts[] = 'miller-text';
        $fonts[] = 'interstate';
    
        return $fonts;
    } );
    #1089764
    _blank

    Hi David,
    That worked
    Thanks
    Scott

    #1089784
    David
    Staff
    Customer Support

    Glad to be of help.
    I can only assume the other code had some ‘funky’ characters within it.

    #2061931
    Benjamin

    Just for completeness, there is a typo in the code of Scott: ‘tu_add_typefit_fonts’ should be ‘tu_add_typekit_fonts’

    #2156521
    Olga

    Hi,

    I tried the same on my website but the fonts don’t show up in my dropdown list.
    I added the code to my child theme instead of the snippet plugin.
    The way of choosing fonts seems to have changed as well, but I don’t know whether that makes a difference?

    The code I used is as follows:

    add_filter( 'generate_typography_default_fonts', 'tu_add_typekit_fonts' );
    function tu_add_typekit_fonts( $fonts ) {
        $fonts[] = 'europa';
        return $fonts;
    };

    Thanks

    #2156577
    David
    Staff
    Customer Support

    Hi there,

    If you’re using the Dynamic Typography:

    https://docs.generatepress.com/article/dynamic-typography-overview/

    Then you DO NOT need that code.
    Instead you:

    1. Add a New Font.
    2. In the Font Family Field name add your font name eg. europa

    Now when you add Typography that font will be available in that list.

    #2156628
    Olga

    That’s amazing!

    Thanks a lot.

    #2156640
    David
    Staff
    Customer Support
    #2262523
    Mark

    Update: I got this to work now.
    I didn’t realize that when i add a font in typography I don’t need to find it in the dropdown, I only need to name it and that is it. This was confusing to me doing this for the first time.

    I have followed the video tutorial and updated my php to what David supplied and I am still not getting this to work.

    I am using WP CodeBox to add the PHP snippet, also tried snippets and the fonts are not showing.

    add_filter( 'generate_typography_default_fonts', function( $fonts ) {
        $fonts[] = 'coniferous';
        $fonts[] = 'new-rubik';
    
        return $fonts;
    } );

    I don’t know what I am doing wrong.
    I can confirm that the css script that I copy from the Adobe project is loading fine in Chrome inspector.

    When I hit add font in the typography settings in the customizer, the adobe fonts do not show.
    I am started from a theme template, Java if that makes any difference.

    Any ideas as to why this is not working?

    #2262575
    Ying
    Staff
    Customer Support

    You don’t need PHP code if you are using the dynamic typography system:
    https://docs.generatepress.com/article/dynamic-typography-overview/

    This original topic is pretty old, most of users are not using dynamic typography.

    Try to follow the tutorial here:
    https://docs.generatepress.com/article/adding-local-fonts/

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