For the equivalent instructions for the Avada theme, see here.
Creating a WordPress child theme is very straightforward, and it allows you to make major customizations that will not be lost when you update or replace the parent theme. Your customizations are all stored within the child theme.
Note: With the Enfold theme, the child theme's style.css
is automatically loaded, so you don't have to load it in functions.php.
Step 1: Create a new folder in wp-content/themes
with the desired name of your child theme.
Step 2: Create a file in the new folder called style.css
with the following contents:
/*
Theme Name: Custom Enfold
Theme URI: http://www.benjaminray.com/example
Description: Custom Version of Enfold Theme
Author: Benjamin Ray
Author URI: http://www.benjaminray.com
Template: enfold
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
Text Domain: custom-enfold
*/
/* Your Custom CSS Here */
Step 3: Create a file in the same folder called functions.php
with the following contents:
<?php
// Add custom JavaScript to child theme (note: get_stylesheet_directory_uri() gets the child theme directory)
function child_theme_js() {
wp_enqueue_script( 'child-script', get_stylesheet_directory_uri() . '/custom.js', ['jquery'], '1.01', true );
}
add_action('wp_enqueue_scripts', 'child_theme_js');
?>
Step 4: Create a file in the same folder called custom.js
and fill it with your custom JS
Step 5: Create an optional image for the theme. The recommended size is 1200x900. Give it the name screenshot.png
and upload it to the root folder for your child theme (same location as the files you just created above).
Step 6: Activate the child theme under Appearance -> Themes -> Child Theme Name
Step 7 (optional): If you have already customized the parent Enfold theme, and you want the settings to be applied to your child theme, go to your child theme's options, click "Import/Export" in the left menu, and click "Import Parent Theme Settings". You may alternatively use the options "Export Theme Settings File" (on the parent theme) followed by "Import Theme Settings File" (on the child theme).