Skip to content

Instantly share code, notes, and snippets.

@jcamp
Last active May 6, 2017 17:50
Show Gist options
  • Save jcamp/267ff71ad3c4ace00b6d30b5bb2bf848 to your computer and use it in GitHub Desktop.
Save jcamp/267ff71ad3c4ace00b6d30b5bb2bf848 to your computer and use it in GitHub Desktop.
DIVI Wordpress Child theme - style.css and functions.php
The correct way to add a child theme to DIVI and other themes.
If you don't understand this you are probably in the wrong place.
More info: https://codex.wordpress.org/Child_Themes
style.css
functions.php
<?php
function my_theme_enqueue_styles() {
$parent_style = 'divi-style'; // This is 'divi-style' for the DIVI theme.
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 ),
wp_get_theme()->get('Version')
);
}
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
?>
/*
Theme Name: divi child theme
URI: http://www.elegantthemes.com/gallery/divi/
Template: Divi
Version: 3.0.41
Description: Smart. Flexible. Beautiful. Divi is the most powerful theme in our collection.
Author: Micro Update Ltd - 01626 200 612
URI: http://www.elegantthemes.com
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, threaded-comments, translation-ready
License: GNU General Public License v2
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment