That article has not been update in a while and might not fully work. If you are trying to add a custom font you can instead use a plugin specific for that or use the @font-face method to add the font to the pages then target the specific areas you want to change the font to the one you imported all with custom CSS.
Currently I'm working on a project and my design calls for a custom font. I have added in my custom font using the "salient_redux_custom_fonts" function. This works well however has a one issue.
The font I use has multiple weights, however, the Salient Options Panel only provides Normal 400, Bold 700, Normal 400 Italic and Bold 700 Italic. Unfortunately, for example the design uses Black 900 for main titles and 100 thin for somethings as well. So far I just use Custom CSS to override these, but, I would prefer it be done at the theme level to save outputting extra code for no reason.
I was wondering if I could could provide the extra font weights using the function somehow or if you would consider adding the ability in a later release.
I tried to use the plugin "Use Any Font" and no luck, not to mention it seems pretty untrustworthy and slow. I would prefer to stick to this method and make a slight adjustment to my code.
I followed the instructions on https://themenectar.ticksy.com/article/9773/ to addd custom @font-face fonts to my site.
The problem I am finding is when the site renders the css it ads the font in like this
The code in my functions.php is as follows
Hi there,
That article has not been update in a while and might not fully work.
If you are trying to add a custom font you can instead use a plugin specific for that or use the @font-face method to add the font to the pages then target the specific areas you want to change the font to the one you imported all with custom CSS.
Am referring to the manual method shown here - https://www.wpbeginner.com/wp-themes/how-to-add-custom-fonts-in-wordpress/
Try that.
Cheers.
Hi There,
Currently I'm working on a project and my design calls for a custom font. I have added in my custom font using the "salient_redux_custom_fonts" function. This works well however has a one issue.
The font I use has multiple weights, however, the Salient Options Panel only provides Normal 400, Bold 700, Normal 400 Italic and Bold 700 Italic. Unfortunately, for example the design uses Black 900 for main titles and 100 thin for somethings as well. So far I just use Custom CSS to override these, but, I would prefer it be done at the theme level to save outputting extra code for no reason.
I was wondering if I could could provide the extra font weights using the function somehow or if you would consider adding the ability in a later release.
Here is my code for reference:
function salient_redux_custom_fonts( $custom_fonts ) { return array( 'Custom Fonts' => array( 'Font Name, Helvetica, Arial, sans-serif' => "Font Name" ) );
}
add_filter( "redux/salient_redux/field/typography/custom_fonts", "salient_redux_custom_fonts" );
I tried to use the plugin "Use Any Font" and no luck, not to mention it seems pretty untrustworthy and slow. I would prefer to stick to this method and make a slight adjustment to my code.
Thanks,
Regan
@reganmcgregor,
Unfortunately there is no such option available at the moment. Best would be to use the Any Font Plugin .
Best
ThemeNectar Support Team