Divi Child Theme

, , ,

Click Here to download the Divi-child.zip file.  The following are the code snippets for the respective files so you can recreate them yourself.  The functions file includes the style.css files from both the parent and child theme. It also gets the current time stamp from the child's style.css file and uses that for the version number so when you update the child's style sheet it updates so your browsers cache will not bring in an older version.

Here is the styles.css code

/*
Theme Name: Divi Child Theme
Description: Divi Child Theme
Author:  Greg Whitehead
Author URI:  http://wpcms.ninja
Template: Divi
Version:  1.0.1
*/

/* =Theme customizations
------------------------------------------------------- */

Here is the code to add to the functions.php file so that the style sheet is based off of time instead of parent version number.

add_action( 'wp_enqueue_scripts', 'divi_engine_dynamic_child_theme', 20  );
function divi_engine_dynamic_child_theme() {    
    wp_enqueue_style( 'parent-theme', get_template_directory_uri() . '/style.css', array(), et_get_theme_version() );    
    wp_enqueue_style( 'child-theme', get_stylesheet_uri(), array(), filemtime( get_stylesheet_directory() . '/style.css' ) );
    
} 
function custom_dequeue() {    
    wp_dequeue_style( 'divi-style' );
    
}

add_action( 'wp_enqueue_scripts', 'custom_dequeue', 1  );
add_action( 'wp_head', 'custom_dequeue', 1 );

 

 

Skills

Posted on

June 21, 2016

Submit a Comment

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