Before you begin, make sure you have a fresh new WordPress install – details here!

The Divi Theme for WordPress has had more updates than any other 2 premium WordPress themes combined since 2004.

I actually have no evidence to support that statement, I simply feel it to be true.

Whatever the case may be, I think we’ve known each long enough where we can be honest with each other: Divi has a TON of updates and that’s a good thing.

It seems like every time I log into one of my client’s websites, there is an update for Divi waiting for me.

While we’re being honest with each other, let me add this: I actually like seeing that update notification. It means Nick Roach and the team of developers over at Elegant Themes are working hard to make my life easier.

However, if you spend any amount of time browsing some of the Facebook groups related to WordPress themes (not just for the Divi theme), you’ll come across plenty of posts that dread updating their theme.

There is no shortage of horror stories about theme updates losing code, moving elements of the site around or straight up breaking sites.

There is a general hesitation, if not slight fear when it comes to updating a theme. The increased heart rate, holding your breath, waiting until you’re sure the update went smoothly.

I’m here to tell you, it doesn’t have to be like that.

There is a better way.

Why Divi Needs a Child Theme

If you’re not currently using a child theme on your website it’s likely because:

You’re actively avoiding child themes because you’re not sure what to do with/how to use them
You’re new to WordPress
You enjoy a general sense of panic, fear or uncertainty in your life.

No matter the reason, I’m going to show you how to create a child theme for Divi (spoiler alert, it’s as simple as a folder with 2 files and 12 lines of code) AND I’m going to straight up give you a free Divi Child Theme you can use immediately.

Real quick, just so you know exactly what we’re doing, this is the description of a Child Theme, directly from the WordPress documentation:

A child theme is a theme that inherits the functionality and styling of another theme, called the parent theme. Child themes are the recommended way of modifying an existing theme.

What this means: a child theme is a way to customize a theme without the risk of having your changes being overwritten when you update your parent theme.

The best part is that you can add CSS to your child theme to customize Divi (or whatever your parent theme is) to ensure your changes stick around after each update. Here’s how to do it.

How to Create Your Own Divi Child Theme

First, from the root folder of your WordPress install, navigate to your themes folder. You can find this by going to your root folder > wp-content > themes.

In our example, we’re just going to create a folder called divi-child but you can name your folder whatever you’d like.

In order to make this a legitimate child theme, we only need 2 files in this folder:
style.css
functions.php

In the style.css file, write the following code at the very top of the file:

/*
Theme Name: Divi Child Theme
Description: A custom Divi child theme built by Green Tree Media.
Author: Green Tree Media, LLC
Author URI: https://greentreemediallc.com
Template: Divi
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: responsive-layout, one-column, two-columns, three-columns, four-columns, left-sidebar, right-sidebar, custom-background, custom-colors, featured-images, full-width-template, post-formats, rtl-language-support, theme-options\, translation-ready
Text Domain: divi-child-theme
*/

There are really only 2 lines that NEED to be in this section in order for the child theme to work correctly.

They are Theme Name and Template. You can completely omit the other lines if you’d like and the Child Theme should still function properly.

Theme name tells WordPress what the name of your theme is and this is what is displayed in the theme selector.

Template tells WordPress which theme is the parent theme. In this case, the parent is Divi.

Below this, you can write whatever custom CSS code you’d like to use to customize the Divi theme.

The Wrong Way

It’s important to note that there is an outdated way of creating a child theme that involved writing the following code in your style.css file:

/*
<pre>
@import url(../parent-theme/style.css);
</pre>
*/

In the above example, instead of ‘parent-theme’ you would write the name of the parent theme you were using.

This is an antiquated way of creating a child theme and should not be used as it could stop working in the future.

If you’re using a child theme which currently has that written in it’s style.css file, I recommend you remove that line. In the second (and final) file we’re going to create, we’ll correctly load in your parent theme’s style.

Create a file in your child theme folder called functions.php file. In this file paste the following:

/*
<pre>
<?php
function child_enqueue_styles() {
wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ );
wp_enqueue_style( ‘child-style’, get_stylesheet_directory_uri() . ‘/style.css’, array( parent-style ) );
}
add_action( ‘wp_enqueue_scripts’, child_enqueue_styles );
</pre>
*/

This will import your parent theme’s stylesheet into your child theme and then also import your custom style.css.

That’s all there is to it. Once you activate this theme, your custom styles should be active and you can add new additional styles to your child theme style.css file without worrying that an update will override custom code.

 

Download Free Divi Child Theme

To make things even easier, I’ve put together a free Divi child theme that’s ready to be installed on any website that’s already running the Divi theme.

To download the child theme, click the link here.

 

Alex Brinkman is the founder of Green Tree Media and prefers his coffee black. He can frequently be found hopping from coffee shop to coffee shop, hunting down reliable wifi connections like an urban Bear Grylls. When he isn’t coding up WordPress plugins to make the web a better place or completing client work, he enjoys competing in 5k obstacle course races. He also has a twin brother that looks nothing like him so you’ll likely never get them confused. Alex is also a sucker for a good motivational quote so feel free to send him your best quote via Twitter at @alexwbrinkman