Created
February 20, 2018 13:01
-
-
Save bkno/421a7742599fe1de089f982d79f8de64 to your computer and use it in GitHub Desktop.
Divi child theme functions.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Create /css and /js subdirectories in child theme directory. | |
Create /css/site.css for front-end styles. | |
Create /js/site.js for front-end scripts. | |
Create /css/admin.css for back-end styles. | |
Create /js/admin.js for back-end scripts. | |
*/ | |
$version = time(); // changes on every page load; set to something like '2018-01-01' in production | |
/* Site CSS */ | |
add_action( 'wp_enqueue_scripts', 'ilm_site_styles' ); | |
function ilm_site_styles() { | |
global $version; | |
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css', [ 'fonts' ], $version ); | |
wp_enqueue_style( 'site-css', get_stylesheet_directory_uri() . '/css/site.css', [ 'fonts', 'parent-style' ], $version ); | |
} | |
/* Site JS */ | |
add_action( 'wp_enqueue_scripts', 'ilm_site_scripts' ); | |
function ilm_site_scripts() { | |
global $version; | |
wp_enqueue_script( 'site-js', get_stylesheet_directory_uri() . '/js/site.js', [ 'jquery' ], $version); | |
} | |
/* Admin CSS */ | |
add_action( 'admin_enqueue_scripts', 'ilm_admin_styles' ); | |
function ilm_admin_styles() { | |
global $version; | |
wp_enqueue_style( 'admin-css', get_stylesheet_directory_uri() . '/css/admin.css', [], $version ); | |
} | |
/* Admin JS */ | |
add_action('admin_enqueue_scripts', 'ilm_admin_scripts'); | |
function ilm_admin_scripts() { | |
global $version; | |
wp_enqueue_script( 'admin-js', get_stylesheet_directory_uri() . '/js/admin.js', [ 'jquery' ], $version); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment