- This topic has 11 replies, 3 voices, and was last updated 5 years, 5 months ago by
David.
-
AuthorPosts
-
March 28, 2020 at 1:41 pm #1213409
sporenborg
HI,
I tried to use your tutorial ‘Adding Local Fonts’ but something doesn’t work.
I added your code:
add_filter( 'generate_typography_default_fonts', function( $fonts ) { $fonts[] = 'XXXX'; return $fonts; } );
… to the GP child theme > functions.php – it didn’t work. Then I downloaded the suggested plugin ‘code snippets’ … the same. Can you pls tell me what I am doing wrong?
Best regards
March 28, 2020 at 2:32 pm #1213452Leo
StaffCustomer SupportHi there,
Just to make sure, you’ve completed all the steps here?
The snippet you used above is only to add it to the customizer.
Let me know 🙂
March 28, 2020 at 2:33 pm #1213454sporenborg
Correct. I added the code to the customizer and added the code for @fontface to the style.css …
March 28, 2020 at 2:51 pm #1213472Leo
StaffCustomer SupportSorry I forgot to provide the link to the article above.
Is the font actually uploaded?
https://docs.generatepress.com/article/adding-local-fonts/#uploading-our-fontMarch 28, 2020 at 2:55 pm #1213474sporenborg
Yes, it is. I used to follow this tutorial. If I enter the font-url it can be downloaded.
March 29, 2020 at 6:59 am #1218386David
StaffCustomer SupportHi there,
when you say it didn’t work – was the Font available in the Customizer ?
March 31, 2020 at 2:26 am #1220480sporenborg
no, the Font isn’t available in the Customizer. But is available in Elementor Pro which we use for the PAGES. GP we use for the blog. There it doesn’t work.
Thats the code I added to the functions.php
add_filter( 'generate_typography_default_fonts', function( $fonts ) { $fonts[] = 'XXXX-Light'; $fonts[] = 'XXXX-Medium'; $fonts[] = 'XXXX-Bold'; $fonts[] = 'XXXX-Heavy'; return $fonts; } );
Do you need any further code exemples?
Thx!
March 31, 2020 at 4:22 am #1220574David
StaffCustomer SupportThat code is used to add the Font Names to the Typography list in the Customizer.
They will appear just after the System Stack fonts and before the Google Fonts.If they are not displaying then there is an issue with your function.php
If they are displaying you will need to add your fonts and @font-face CSS as explained here:
April 6, 2020 at 1:22 am #1228100sporenborg
Thank you very much for your comments. I have – in my opinion – proceeded exactly as recommended by you. Yet it does not work. Nothing appears after the System Stack fonts and before the Google Fonts. Do you have any other idea?
April 6, 2020 at 6:12 am #1228376David
StaffCustomer SupportCan you try adding the Code using the Code Snippets plugin ?
April 7, 2020 at 10:50 am #1230204sporenborg
Hello David, you’re my hero! As usual, the problem was sitting in front of the monitor and in the rush it read the text only selectively. From the pagebuilders I was used to find the local fonts appearing before the system stack fonts. But you had written that they appear after the system stack fonts. I did not search there.
For all those who also stumble across this thread, the hint: Finally, inserting the code
add_filter( 'generate_typography_default_fonts', function( $fonts ) { $fonts[] = 'Open Sans'; return $fonts; } );
to find here … https://docs.generatepress.com/article/adding-local-fonts/ …
also works without the Code Snippet module. I try to work more and more with less plugins and reduce the use of pagebuilders since I use GP to increase the page speed.
Thank you very much for your great support, which I will surely use a few more times.
April 8, 2020 at 1:31 am #1230845David
StaffCustomer SupportAwesome – glad you got it resolved.
-
AuthorPosts
- You must be logged in to reply to this topic.