- This topic has 16 replies, 5 voices, and was last updated 1 year, 9 months ago by Ying.
-
AuthorPosts
-
December 2, 2019 at 6:06 am #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
ScottDecember 2, 2019 at 6:26 am #1089565DavidStaffCustomer SupportHi 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?December 2, 2019 at 6:39 am #1089585_blankHi 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
ScottDecember 2, 2019 at 6:40 am #1089594DavidStaffCustomer SupportCan you share the code you have added?
December 2, 2019 at 6:42 am #1089597_blankYeah sure
add_filter( 'generate_typography_default_fonts', 'tu_add_typefit_fonts' ); function tu_add_typekit_fonts( $fonts ) { $fonts[] = 'miller-text'; $fonts[] = 'interstate'; return $fonts; };
December 2, 2019 at 6:49 am #1089653DavidStaffCustomer SupportHmmm 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; } );
December 2, 2019 at 7:00 am #1089764_blankHi David,
That worked
Thanks
ScottDecember 2, 2019 at 7:09 am #1089784DavidStaffCustomer SupportGlad to be of help.
I can only assume the other code had some ‘funky’ characters within it.December 28, 2021 at 9:31 am #2061931BenjaminJust for completeness, there is a typo in the code of Scott: ‘tu_add_typefit_fonts’ should be ‘tu_add_typekit_fonts’
March 16, 2022 at 5:12 am #2156521OlgaHi,
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
March 16, 2022 at 6:11 am #2156577DavidStaffCustomer SupportHi 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.
March 16, 2022 at 6:47 am #2156628OlgaThat’s amazing!
Thanks a lot.
March 16, 2022 at 6:54 am #2156640DavidStaffCustomer SupportYou’re welcome
June 23, 2022 at 9:14 am #2262523MarkUpdate: 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?
June 23, 2022 at 10:22 am #2262575YingStaffCustomer SupportYou 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/ -
AuthorPosts
- You must be logged in to reply to this topic.