How to add a new custom font in the font dropdown?

This code is needed to add a Custom Web Font to the typography options dropdown. It will work with all the themes, except Maya, Sommerce, Sheeva, Di'verso, Bolder, Meménto, Suerte, Samarcanda and Kassyopea.

 

In the example we will use the font Helvetica.

 

Add this code to your functions.php file located in theme-folder/, at the end of the file. You can also find the file in Appearance > Editor > Theme Functions (functions.php)

function yit_add_custom_webfont( $fonts ) {
    $fonts['Helvetica'] = '"Helvetica", sans-serif;';
    return $fonts;
}
add_filter( 'yit_web_fonts', 'yit_add_custom_webfont' );

Remember when you will update the theme, you can leave the code inside this file.

Was this article helpful?
2 out of 2 found this helpful

Back to Help Center

Powered by Zendesk