Divi Tips 101: custom fonts

Divi custom fonts: how does it work?

Updated on 09/09/20

2378 words

8 minutes of reading
49 comments

This article contains affiliate links recognizable by the percentage icon (%) → I am an affiliate link

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 versionEOTOTF/TTFWOFFWOFF2SVG
IE 8x
IE 9-11xxx
EDGE 12-14xx
FIREFOX 40 to 45xxx
CHROME 43-49xxx
SAFARI 8-9xxx
OPERA 32-35xxx
iOS SAFARI 8.4 to 9.1xxx
ANDROID 4.4-44xx
CHROME for Android 46xxx
Compatibility of font formats according to browsers (source).

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
Disable Google Fonts in Divi

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.

more resources for Divi

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
Convert OTF font to TTF with Convertio.co
  1. See you on the converter Convertio.co and download your TTF or OTF file. For my example, it is AlexBrush-Regular.ttf.
  2. Choose the format in which this file should be converted. In my case, I choose OTF because I already have the TTF file.
  3. Validate by clicking Convert.
  4. 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
Import fonts into the Divi Builder
  1. 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.
  2. From the drop-down menu, choose "Getting Online".
  3. Choose custom font files. Also think about naming your police. For my example, I named him Alexa.
  4. At a minimum import OTF and TTF files.
  5. 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
Set fonts for the entire site.

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
Problem when importing custom font within the Divi Builder

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
Edit wp-config.php to allow custom font import in Divi

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
Allow OTF and TTF files in WordPress
  1. Go to tab Extensions > Add and look for extension Mime Types Plus. Install it and activate it.
  2. Go to the tab Mime Types Plus > Edit Mime Type.
  3. To allow OTF files: note otf in the extension field, font/otf in the Mime Type field and choose Document as a file type.
  4. 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
Convert fonts with FontSquirrel
  1. See you on the official website of FontSquirrel and download the custom font file you have in your possession (e.g. OTF or TTF).
  2. Select Mode EXPERT.
  3. Check all file formats.
  4. Leave the other options as they stand and accept the terms. Click DOWNLOAD YOUR KIT.
  5. 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
CSS style sheet for custom fonts
  1. 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;
}
  1. 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
Add a custom font via the theme Divi
  1. Visit the website Google Fonts. Find your font and select it by clicking on +Select this style.
  2. A side panel opens.
  3. In the tab Embed, you will find the code to implement in Divi. Copy the first.
  4. 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">
  1. 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;
}
  1. 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:

Personal Divi fonts
Add Divi Custom Fonts

Get Divi

Divi training

Ebook Divi PDF

Free tips

Divi Quiz

Live coaching

icon 256x256

Proudly translated by wpLingua, the translation extension for WordPress That I develop! SEO-Friendly / Automatic / Editable

49 Comments

  1. Anne-Laure
  2. Lycia Diaz
  3. Anne-Laure
  4. Anne-Laure
  5. Lycia Diaz
  6. Anne-Laure
  7. Lycia Diaz
  8. Emilie
  9. granon
  10. Emilie
  11. Lycia Diaz
  12. Lycia Diaz
  13. Granon Sandrine
  14. Lycia Diaz
  15. Elisa Morgand
  16. Lycia Diaz
  17. François LIEURY
  18. Hank
  19. Lycia Diaz
  20. Lycia Diaz
  21. Emilie
  22. Lycia Diaz
  23. Emilie
  24. Isabelle
  25. isabelle
  26. Lycia Diaz
  27. Lycia Diaz
  28. Anthony F
  29. Emma
  30. Lycia Diaz
  31. Mathilde
  32. Lycia Diaz
  33. Lycia Diaz
  34. ValMer
  35. Aurore V
  36. Lycia Diaz
  37. Lycia Diaz
  38. ValMer
  39. Lycia Diaz
  40. Aline
  41. Lycia Diaz
  42. Marine
  43. Lycia Diaz
  44. Melinda
  45. Amélie
  46. Lycia Diaz
  47. Louis Bertin
  48. softbigs
  49. Lycia Diaz

Submit a comment

Your email address will not be published. Required fields are indicated with *

This site uses Akismet to reduce undesirables. Learn more about how your feedback data is used.