A Divi custom font is a font that is not natively available within the Divi editor or even the WordPress editor (Gutenberg). However, depending on your project or that of your client, it is likely that you will have to use specific fonts that have been custom-made for the project or that have been purchased on a dedicated platform. This is a far cry from the eternal Google Fonts that are everywhere.
In this article, I will explain how to implement a custom font in your Divi projects. You will see that there are several ways, some simple and some more complex.
- 1 - Why use a custom font in Divi?
- 2 - Font formats for the Web
- 3 - Custom font vs Google Font
- 4 - Where to find custom fonts?
- 5 - Custom font via the Divi Builder
- 6 - Custom font in a child theme (@font-face method)
- 7 - Custom font via Divi settings
- 8 - In conclusion...
Announcement: this article contains affiliate links that you will easily recognise. The classic links are in purple and sponsored links are in pink.
1 - Why use a custom font in Divi?
Not all web projects look the same, or at least shouldn't look the same... That's why using a custom font - also called Custom Font - is a good starting point to differentiate your site from "common" sites.
A customised font allows you to fit in perfectly with your corporate identity. For example, the font used for your logo could be used on your website. In this way, a homogeneity is created between your various communication supports.
Did you know that you can test Divi for free? Go to this page and click on "TRY IT FOR FREE
2 - Font formats for the Web
Font files are available in several formats that are supported more or less well by browsers (Chrome, Firefox, Opera, Safari...).
TTF (TrueType Font) and OTF (OpenType Font) are the best supported font formats:
|IE 9 to 11
|EDGE 12 to 14
|FIREFOX 40 to 45
|CHROME 43 to 49
|SAFARI 8 to 9
|OPERA 32 to 35
|iOS SAFARI 8.4 to 9.1
|ANDROID 4.4 to 44
|CHROME for Android 46
So according to this table, you understand that depending on the font files you import into your site, some browsers will not be able to interpret them.
For example, if you import fonts in EOT or SVG format, very few users will see them.
The solution would be to import all font formats into your site so that all your users can benefit.
If you don't have all these formats, you will just have to generate them via FontSquirrel (we will see that later). But in practice, if you use TTF or OTF fonts, this should be more than enough(who uses Internet Explorer anymore? Seriously! I haven't touched it since 1998).
The other solution, which is more of a fallback, is to specify in your code the basic fonts that should be supported by the browser in case it fails to display your custom font. For example, you could specify Arial, Times New Roman, Verdana, Cursive, etc.
Don't delay! Discover the Divi theme here !
3 - Custom font vs Google Font
Here's a question you might ask: why bother using a custom font when most WordPress themes, including Divi, allow you to use the Google Fonts catalogue?
It is true that the choice is vast and it is rare not to find something to suit your needs with the multitude of fonts available. However, most of them are seen and seen again. But there is another point to be made: confidentiality.
Indeed, using this service, the Google Fonts API provides the fonts requested when visiting a web page from Google's servers. This is stored in your visitor's browser cache and is updated as necessary. As a result, Google retrieves the IP address of your visitor, which is nothing more than personal data. In this case, the GDPR should be respected and you should obtain the visitor's consent to display your fonts.
It is also for these reasons that Divi offers to disable Google Font s for your project:
To disable Google Fonts in Divi, simply go to the Divi tab > Theme Options > General and uncheck the option to use Google Fonts.
If you decide to do without this service, you will certainly need the rest of this article...
4 - Where to find custom fonts?
There are lots of sites to find custom fonts but remember to respect copyright. Indeed, free fonts are not necessarily free of rights, that's the first thing to remember.
Secondly, you should know that there are premium fonts, i.e. fonts that have to be paid for. In this case, be sure to refer to the licence of these fonts because some can be used in your commercial projects and others only in your personal projects. So, make sure you get the right information.
Finally, here is a list of sites where you can find beautiful fonts:
On the Web, it is quite common to use a classic font for the body text and a slightly more sophisticated font for your headline fonts. Sites like Typespiration or FontJoy s help to find the right balance between the two.
5 - Custom font via the Divi Builder
This is the easiest option! Once you have found your ideal font(s) and have their files, here are the steps to install them in Divi :
5.1 - Be in possession of at least the .ttf and .otf files
Depending on the platforms on which you have found your fonts, you may be in possession of a font in .ttf or .otf format. To be on the safe side, you should have both, at least you are safe...
So if you only have one of two, you can use a :
- Go to the converter Convertio.co and upload your TTF or OTF file. For my example, it is AlexBrush-Regular.ttf.
- Choose the format into which this file should be converted. In my case, I choose OTF because I already have the TTF file.
- Confirm by clicking on Convert.
- Upload your file, you will need it...
You now have the OTF and TTF files.
5.2 - Importing custom fonts via the Divi Builder
The rest of the process is simple:
- Open a publication (page or article) with the Divi Builder and insert a Text module. Go to the Style tab to set the font by clicking on the drop-down menu.
- In the drop-down menu, choose "Go online".
- Choose the files for the custom font. Also remember to name your font. For my example, I named it Alexa.
- Import at least the OTF and TTF files.
- Validate by clicking on upload.
Your custom font should now be functional...
5.3 - Setting a default custom font
Now that you have your custom font, you could make it the "default" font for your entire site.
This way, you don't have to define your new font every time you use the Divi Builder, saving you a lot of time.
Simply go to the Appearance > Customise > General Settings > Typography tab and select your new font. You can set your font for all the headings on your site (header font) as well as your font for the body of the site.
5.4 - Problem importing your font into Divi
It may happen that you are unable to import your custom font into the Divi Builder, which shows :
"Sorry, this type of file is not allowed for security reasons.
There are two ways to correct the problem:
5.4.1 - Solution 1: correct via wp-config.php
If you are comfortable with WordPress, your server and your FTP software, all you have to do is edit the wp-config.php file at the root of your site and write the following line of code at the end of the file:
Please note that for security reasons, you should delete this line of code as soon as you have finished importing your custom fonts into Divi!
5.4.2 - Solution n°2: correct with an extension
If you are not at all comfortable with handling files within your server, then you should use a dedicated :
- Go to the Extensions tab > Add and search for the extension Mime Types Plus. Install and activate it.
- Go to the Mime Types Plus tab > Edit Mime Type.
- To allow OTF files: note otf in the extension field, font/otf in the Mime Type field and choose Document as the file type.
- To allow files TTF files: note ttf in the extension field, font/ttf in the Mime Type field and choose Document as the file type.
Now you can start the import again (step 5.2 of this article) and you should not have the problem again.
6 - Custom font in a child theme (@font-face method)
There is another way to implement a new font in your WordPress site, and that is the @font-face method. This works for any theme, not just Divi.
You simply need to add your custom font files within your child theme and add a few lines of code to its style.css file.
- Go to the official website of FontSquirrel and upload the file of the custom font you have (e.g. OTF or TTF).
- Select the mode EXPERT.
- Check all file formats.
- Leave the other options as they are and accept the terms and conditions. Click on DOWNLOAD YOUR KIT.
- You now have a folder containing several files. Select the 5 font formats (EOT, SVG, TTF, WOFF and WOFF2) and place them in the root of your Divi child theme.
- Then open the style.css file of your child theme and place in it the code contained in the stylesheet.css file provided by FontSquirrel. This code looks like this:
src: url('goldie_rainbow-webfont.eot?#iefix') format('embedded-opentype'),
- Then define which HTML tags should use this custom font. The CSS code could look like this:
font-family: goldie_rainbowregular, Arial, sans-serif;
font-family: goldie_rainbowregular, Arial, sans-serif;
font-family: goldie_rainbowregular, Arial, sans-serif;
As you can see in the code above, the font "goldie_rainbowregular" is used for level 1, 2 and 3 titles. The second value (Arial) and the third value (sans-serif) are backup fonts that will be taken into account by browsers in case they fail to load your custom font.
I can see that this method is much more complex than the previous one but it is the classic and universal way to add a custom font to a WordPress theme.
7 - Custom font via Divi settings
There is one last solution for adding custom fonts to Divi. This is if your font is hosted elsewhere on the web or if you need a Google Font that is not yet available in the Divi Builder (this can happen).
Here's how to do it:
- Visit the Google Fonts. Find your font and select it by clicking on +Select this style.
- A side panel opens.
- In the Embedtab, you will find the code to implement in Divi. Copy the first one.
- Retournez dans l’administration de votre site à l’onglet <strong>Divi > Options du thème > Intégration</strong> et collez ce code dans le premier champ, la section <strong><head></strong> du site. Le code devrait ressembler à cela :
- Then, you will have to define in your CSS style sheet which elements should use this new font. For example, if I want my H4 titles to use the Lobster font, here is the code to add to the Appearance > Customise > Additional CSS tab:
font-family: 'Lobster', cursive;
- Now, regardless of the editor used (Gutenberg or Divi), all fonts defined in the style sheet must be functional on the entire site.
8 - In conclusion...
Fonts, colours and images are the most important elements in a website design. As with all things WordPress, there are various ways to achieve this. I hope this tutorial has helped you to better understand how WordPress and Divi and will have helped you move forward with your site projects.
To go further, here is a reading list that should interest you:
- How to download fonts in WordPress without a plugin.
- 50 typography terms used in web design.
- 3 tools to find a font from an image.
- 40 best free fonts.
- How to import TypeKit fonts into WordPress.
- How to create your own custom font.