-
FunkyCss
Hallo I have followed the instructions of GP for the local custom fonts, but I cant make them work on my editor.
What I have done till now is this
style.css ( Child Theme )
/* PFBagueSansPro - Regular */ @font-face { font-family: 'PFBagueRegular'; font-style: normal; font-weight: 400; /* Regular */ src: url('/wp-content/themes/generatepress_child/fonts/PFBagueSansPro-Regular.otf') format('opentype'); } /* PFBagueSansPro - Bold */ @font-face { font-family: 'PFBagueSansPro'; font-style: bold; font-weight: 700; /* Bold */ src: url('/wp-content/themes/generatepress_child/fonts/PFBagueSansPro-Bold.otf') format('opentype'); } /* PFBagueSansPro - Black */ @font-face { font-family: 'PFBagueBlack'; font-style: normal; font-weight: 700; /* Black */ src: url('/wp-content/themes/generatepress_child/fonts/PFBagueSansPro-Black.otf') format('opentype'); } @font-face { font-family: 'PFBagueBlackBold'; font-style: normal; font-weight: bold; src: url('wp-content/themes/generatepress_child/fonts/PFBagueSansPro-Bold.otf') format('opentype'); }
Functions PHP
add_filter( 'generate_editor_styles', function( $editor_styles ) { $editor_styles[] = 'style.css'; return $editor_styles; } );
Which by the way does not show the available fonts on the customizer and its font weights, but If I write it down it works – but still on the front end.
Thanks in advance
-
Hi there,
Which by the way does not show the available fonts on the customizer
You need to type the local fonts and weights into your typography system, then you can select the font for different elements.
https://docs.generatepress.com/article/adding-local-fonts/#adding-our-fontThe PHP looks correct, maybe try using the full URL for the font files in your CSS.
Let me know if that works!
-
FunkyCss
Hello,
I am using the full url, just removed it for your preview.You need to type the local fonts and weights into your typography system
Sorry but I dont understand what are you saying here.
-
FunkyCss
Sorry, as I get you mean to type exactly the font name, yes this is what i do and it work but it cant recognise exactly the fonts, meaning that it does not show up as you mention on your video tutorial.
Thats the reason I shared with you the font css.
Please let me know
Thanks
-
but it cant recognise exactly the fonts, meaning that it does not show up as you mention on your video tutorial.
Sorry, I don’t understand, what do you mean by it can’t recognize exactly the fonts?
-
FunkyCss
Hey, sorry for the inconvenience
I mean I cant find the font when I search on the customizer, the PHP function is not supposed to do that?
-
I mean I cant find the font when I search on the customizer
The font will not show in the dropdown list, you need to manually type the font by clicking the
add font
button. Can you check this link?https://docs.generatepress.com/article/adding-local-fonts/#adding-our-fontthe PHP function is not supposed to do that?
No, it doesn’t.
The PHP is to apply the font to the text in the block editor, as by default, the local fonts will not apply to text in the block editor.
- You must be logged in to reply to this topic.