A child theme is a sub-theme that inherits all the functionality and style of the main theme, also called the parent theme. Child themes are a safe way to modify an active WordPress theme without directly altering it.
Using a Child theme will ensure that any customization is preserved when the parent theme is updated.
Notes:
Having a Child theme is not required if you only use CSS customizations. You can place your custom CSS code in Divi → Theme Options → General Tab → Custom CSS.
If you plan to modify Divi's theme files, such as header.php or footer.php, you will need to create a Child theme to retain those changes when updating.
For more information, you can also check the Ultimate Guide to Creating a Divi Child Theme guide.
There are two ways you can use to create a child theme for Divi:
Using the Child Theme Configurator third-party plugin
Log in to the WordPress Dashboard
Go to Plugins → Add new
Search for Child Theme Configurator
Install it and Activate it
Go to Tools → Child Themes
Ensure the Create a new Child Theme option is selected
Ensure that Divi is selected as the Parent Theme
Click on the Analyze button
Choose the Primary Stylesheet (style.css) option
Choose Use the WordPress style queue option
Click on the Create New Child Theme button
Go to Appearance → Themes and activate the new Child Theme
Creating the Child Theme from scratch (advanced)
Creating a child theme from scratch is easier than it sounds. We only need a code editor, such as VS Code, Sublime Text, or any other code editor.
Create a new folder on your local computer and name it divi-child
Inside the divi-child folder, create a new file called style.css and place the following CSS code:
/*
Theme Name: Divi Child Theme
Theme URI: http://yourwebsite.com
Description: Child Theme For Divi
Author: Your Name
Author URI: http://yourwebsite.com
Version: 1.0.0
Template: Divi
*/Theme Name: It's the child's theme name. It can be anything you want. Usually, I use Divi's Child Theme
Theme URI: Represents the child theme author's website URL.
Description: a short description of your child's theme. You can include things like color scheme used, features added, etc
Author: The person's name who has created the Child theme
Author URI: This could be your business website, or it can be the actual URL of the website where the child theme is used
Template: It is the parent theme name folder. In this case, that would always be Divi - case sensitive.
In the divi-child folder, create a second file and name it functions.php
Place the following PHP code inside the functions.php file:
<?php
/*================================================
#Load the Parent theme style.css file
================================================*/
function dt_enqueue_styles() {
$parenthandle = 'divi-style';
$theme = wp_get_theme();
wp_enqueue_style( $parenthandle, get_template_directory_uri() . '/style.css',
array(), // if the parent theme code has a dependency, copy it to here
$theme->parent()->get('Version')
);
wp_enqueue_style( 'child-style', get_stylesheet_uri(),
array( $parenthandle ),
$theme->get('Version')
);
}
add_action( 'wp_enqueue_scripts', 'dt_enqueue_styles' );Zip the entire folder, which should contain the two files: style.css and functions.php
Go back to your WordPress Dashboard → Appearance → Themes
Click on the Add New Theme button
Click on the Upload Theme button
Choose the zip file from Step 5
Click on the Install Now button
Activate the new Child theme
Pro Tip: you can download a ready-to-use Divi Child theme from this GitHub page.