One Divi custom font is a font that is not available natively within the publisher Divi or even that of WordPress (Gutenberg). However, depending on your project or your client's project, it is likely to have to use specific fonts which have been tailor-made for the project or have been purchased on a dedicated platform. So we are far from the eternal Google Fonts That we find 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 others more complex.
1 – Why use a custom font in Divi?
Not all web projects look the same, or at least should not 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 custom font lets you stick perfectly to your graphic chart. For example, the font used for your logo could be used on your website. Thus, homogeneity is created between your various communication media.
Do you know you can test Divi for free? See you on this page and click on "TRY IT FOR FREE"
2 - Font formats for the Web
Font files are available in several formats supported more or less well by browsers (Chrome, Firefox, Opera, Safari...).
TTF (TrueType Font) and OTF (OpenType Font) are the best supported font formats:
Browser version | EOT | OTF/TTF | WOFF | WOFF2 | SVG |
---|---|---|---|---|---|
IE 8 | x | ||||
IE 9-11 | x | x | x | ||
EDGE 12-14 | x | x | |||
FIREFOX 40 to 45 | x | x | x | ||
CHROME 43-49 | x | x | x | ||
SAFARI 8-9 | x | x | x | ||
OPERA 32-35 | x | x | x | ||
iOS SAFARI 8.4 to 9.1 | x | x | x | ||
ANDROID 4.4-44 | x | x | |||
CHROME for Android 46 | x | x | x |
So based on this table, you understand that depending on the font files you will 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 then import all font formats into your site so that all your users can benefit.
If you are not in possession of all these formats, you will need to generate them via FontSquirrel (we'll see about that later). But concretely, if you use TTF or OTF fonts, this should be largely enough (Who still uses Internet Explorer? Seriously! For my part, I haven't touched that since 1998).
The other solution, which is rather a backup solution, is to indicate in your code the basic fonts that must be supported by the browser in case it does not manage to display your custom font. For example, you can indicate Arial, Times New Roman, Verdana, Cursive, etc.
Don't delay! Discover the theme Divi here !
3 – Custom font vs Google Font
Here's a question you can ask yourself: why bother using a custom do since most WordPress themes, including Divi, allow to use the catalog of Google fonts (Google Fonts)
It is true that the choice is very broad and it is rare not to find shoes at his foot with the multitude of fonts available. Yet most of them are seen and reviewed. That's right... But there is also another point to be addressed: confidentiality.
Indeed, using this service, Google Fonts API provided the fonts requested when visiting a web page from Google servers. Everything is stored in your visitor's browser cache and is updated if necessary. As a result, Google recovers your visitor's IP address which is nothing but personal data. In this case, the GDPR should be respected and you should obtain the visitor's consent to view your policies.
Using Google Font is not illegal but your privacy policy page will have to inform your visitor as required by the GDPR. You will also need to link to Google's privacy policy. To find out more about this, I advise you to read this article in detail.
It is also for these reasons that Divi proposes deactivation of Google Fonts fonts for your project:
![Deactivate Google Fonts Divi](https://astucesdivi.com/wp-content/uploads/2020/09/desactiver-google-fonts-divi.jpg)
To disable the Google Fonts of Divi, just go to the tab Divi > Theme Options > General and uncheck the option of using Google Fonts.
If you decide to dispense with this service, you will certainly need the continuation of this article...
4 - Where to find custom fonts?
There are lots of sites to find custom fonts but don't forget to respect copyrights. Indeed, the Free fonts This is the first thing to remember.
Secondly, we need to know that there are Premium fonts, i.e. paid fonts. In this case, refer to the license of these fonts as some can be used in your commercial projects and others only in your personal projects. So, make sure you find out.
Finally, here is a list of sites where you can find beautiful fonts:
In the Web, it is quite common to use a classic font for the text body and a slightly more sophisticated font for your title fonts. Sites like Typespiration or FontJoy to find the right balance between the two.
5 - Custom font via the Divi Builder
It's the easiest option! Once you have found your ideal font(s) and are in possession of their files, here are the steps to install them in Divi:
5.1 – Be in possession of .ttf and .otf files at least
Depending on the platforms on which you found your fonts, you can be in possession of a font in format .ttf or .otf. For security, you need both, at least you're quiet...
So if you only have one in two, you can use a file converter:
![Convert a TTF font to OTF](https://astucesdivi.com/wp-content/uploads/2020/09/convertir-ttf-otf.jpg)
- See you on the converter Convertio.co and download your TTF or OTF file. For my example, it is AlexBrush-Regular.ttf.
- Choose the format in which this file should be converted. In my case, I choose OTF because I already have the TTF file.
- Validate by clicking Convert.
- Download your file, you will need it...
Here you are now in possession of OTF and TTF files.
5.2 - Import custom fonts via the Divi Builder
The rest of the process is simple:
![Insert Divi Custom Fonts](https://astucesdivi.com/wp-content/uploads/2020/09/inserre-polices-personnalisees-divi.jpg)
- Open a publication (page or article) with the Divi Builder and insert a Text module. Go to tab Style to set the font by clicking on the drop down menu.
- From the drop-down menu, choose "Getting Online".
- Choose custom font files. Also think about naming your police. For my example, I named him Alexa.
- At a minimum import OTF and TTF files.
- Validate by clicking online.
Here, your custom font should be functional...
5.3 - Set a default custom font
Now that you're in possession of your custom font, you could him assign the default role for your entire site.
So you don't need to define your new font every time you use the Divi Builder, so you will save a lot of time.
![Police By Defaut](https://astucesdivi.com/wp-content/uploads/2020/09/police-par-defaut.jpg)
Just go to the tab Appearance > Customize > General settings > Typography and select your new font. You can set your font for all the titles of your site (header police) as well as your font for the body of the site.
5.4 – Problem when importing your font into Divi
![Problem Import Police Divi](https://astucesdivi.com/wp-content/uploads/2020/09/probleme-import-police.jpg)
Sometimes you may not be able to import your custom font into the Divi Builder, which states:
"Sorry, this type of file is not allowed for security reasons."
Two solutions are available 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, you will just edit the file wp-config.php present at the root of your site and enter the following line of code at the end of the file:
define('ALLOW_UNFILTERED_UPLOADS', true);
![Wp Config File](https://astucesdivi.com/wp-content/uploads/2020/09/wp-config-fichier.jpg)
Attention, for security reasons, precisely, you will have to delete this line of code as soon as you have finished importing your custom fonts in Divi!
5.4.2 – Solution 2: correct with an extension
If you are not at all comfortable with handling files within your server, then prefer using a dedicated extension:
![Allow Ttf Otf WordPress](https://astucesdivi.com/wp-content/uploads/2020/09/autoriser-ttf-otf-wordpress.jpg)
- Go to tab Extensions > Add and look for extension Mime Types Plus. Install it and activate it.
- Go to the tab Mime Types Plus > Edit Mime Type.
- To allow OTF files: note otf in the extension field, font/otf in the Mime Type field and choose Document as a file type.
- To allow files TTF Note: ttf in the extension field, font/tff in the Mime Type field and choose Document as a file type.
Here you can start again import (Step 5.2 of this article) and you should not encounter the problem anymore.
6 - Custom font in a child theme (method @font-face)
Another solution exists for implement a new font in your WordPress site, it is the @font-face method. This one works for any theme, not just Divi.
You just need to add files from your custom fonts within your child theme and add a few lines of code to its file style.css.
![Font Squirrel Converter](https://astucesdivi.com/wp-content/uploads/2020/09/font-squirrel-converter.jpg)
- See you on the official website of FontSquirrel and download the custom font file you have in your possession (e.g. OTF or TTF).
- Select Mode EXPERT.
- Check all file formats.
- Leave the other options as they stand and accept the terms. Click DOWNLOAD YOUR KIT.
- You are now in possession of a folder containing several files. Select the 5 font formats (EOT, SVG, TTF, WOFF and WOFF2) and place them at the root of your Divi child theme.
![Css Divi Police](https://astucesdivi.com/wp-content/uploads/2020/09/css-divi-police.jpg)
- Then open the file style.css of your child theme and place the code in the file stylessheet.css provided by FontSquirrel. This code looks like this:
@font-face {
font-family: 'goldie_rainbowregular';
src: url('goldie_rainbow-webfont.eot');
src: url('goldie_rainbow-webfont.eot?#iefix') format('embedded-opentype'),
url('goldie_rainbow-webfont.woff2') format('woff2'),
url('goldie_rainbow-webfont.woff') format('woff'),
url('goldie_rainbow-webfont.ttf') format('truetype'),
url('goldie_rainbow-webfont.svg#goldie_rainbowregular') format('svg');
font-weight: normal;
font-style: normal;
}
- Then specify which HTML tags should use this custom font. The CSS code might look like this:
h1 {
font-family: goldie_rainbowregular, Arial, sans-serif;
font-size: 48px;
}
h2 {
font-family: goldie_rainbowregular, Arial, sans-serif;
font-size: 36px;
}
h3 {
font-family: goldie_rainbowregular, Arial, sans-serif;
font-size: 24px;
}
As you see in the above code, the police « goldie_rainbowregular » is used for Level 1, 2 and 3 titles. The second value (Arial) and the third value (without-serif) are Emergency police which will be taken into account by browsers in case they fail to load your custom font.
I can conceive that this method is much more complex than the previous one but it's the classic and universal way to add a custom font in a WordPress theme.
7 - Custom font via Divi settings
There is one final solution for add custom fonts in Divi. This is valid if your font is hosted elsewhere on the Web or if you need font Google Font which is not yet available in the Divi Builder (this can happen).
Here's how:
![Custom Font Divi](https://astucesdivi.com/wp-content/uploads/2020/09/custom-font-divi.jpg)
- Visit the website Google Fonts. Find your font and select it by clicking on +Select this style.
- A side panel opens.
- In the tab Embed, you will find the code to implement in Divi. Copy the first.
- Go back to the administration of your site on the tab Divi > Theme Options > Integration and paste this code in the first field, section the site. The code should look like this:
<link href="https://fonts.googleapis.com/css2?family=Lobster&display=swap" rel="stylesheet">
- 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 police Lobster, here is the code to add to the tab Appearance > Customize > Additional CSS :
h4 {
font-family: 'Lobster', cursive;
font-size: 24px;
}
- 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, colors and images are the most important elements in a graphic charter and in a website design. Like all the time with WordPress, there are various ways to achieve its ends. I hope this tutorial will help you to better understand the operation of WordPress and Divi and have helped you advance your site projects.
To go further, here is a playlist that should interest you:
- How to download fonts in WordPress without plugin.
- 50 terms of typography used in webdesign.
- 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.
![Personal Divi fonts](https://astucesdivi.com/wp-content/uploads/2020/09/polices-perso-divi-pin-688x1024.jpg)
![Add Divi Custom Fonts](https://astucesdivi.com/wp-content/uploads/2020/09/ajouter-police-divi-pin-689x1024.jpg)
49 Comments