Step 1: Download and Install the Custom Fonts Plugin
Download the Custom Fonts plugin from this link, and install it on your WordPress site.
Step 2: Upload Your Fonts
After installing and activating the plugin:
- Go to Custom Fonts settings in your WordPress admin panel.
- Upload your font files (e.g.,
.woff,.woff2,.ttf, etc.).
Step 3: Add the Custom Fonts to Salient Typography
To make your custom fonts appear in Salient’s typography settings, add the following code snippet to your theme’s functions.php file:
phpCopy codefunction salient_redux_custom_fonts() {
return array(
'Custom Fonts' => array(
'Neo Sans Std Regular' => 'Neo Sans Std Regular',
'Neo Sans Std Bold' => 'Neo Sans Std Bold'
)
);
}
add_filter( "redux/salient_redux/field/typography/custom_fonts", "salient_redux_custom_fonts" );
Explanation of the Code
- Function Name:
salient_redux_custom_fonts()defines a list of custom fonts for the Salient theme. - Custom Fonts Array:
'Neo Sans Std Regular' => 'Neo Sans Std Regular': This maps the font name so that it appears in the typography settings dropdown in Salient.- Add additional fonts as needed by following the same format.
- Filter Hook: The
redux/salient_redux/field/typography/custom_fontsfilter connects the custom fonts with Salient’s typography settings.
Final Steps
- Go to Salient Theme Options > Typography.
- Your custom fonts (e.g., “Neo Sans Std Regular” and “Neo Sans Std Bold”) should now appear in the typography settings dropdown.
- Apply them to the desired elements of your website.
That is an easy way to add a custom font to Salient WordPress theme. For more tips go to our blog.