Archived topic
Adobe fonts
16 replies · Started by _blank on December 2, 2019
Hi
Is there safe way of adding adobe typekit fonts, i've tried this method from your tube and it crashes my test site.
https://www.youtube.com/watch?v=ZSbhJ-twIDk
Thanks
Scott
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?
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
Can you share the code you have added?
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;
};
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;
} );
Hi David,
That worked
Thanks
Scott
Glad to be of help.
I can only assume the other code had some 'funky' characters within it.
Just for completeness, there is a typo in the code of Scott: 'tu_add_typefit_fonts' should be 'tu_add_typekit_fonts'
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
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.
That's amazing!
Thanks a lot.
You're welcome
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?
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/