Last active
May 14, 2019 08:41
-
-
Save pixelstorm/efafa22ead0693146acd2a4a159fd48c to your computer and use it in GitHub Desktop.
child theme header code and function to load style sheet
This file contains hidden or 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
/* | |
Theme Name: Custom Child theme | |
Theme URI: http://example.com/twenty-fifteen-child/ | |
Description: Custom Theme Child Theme | |
Author: Daniel Florido | |
Author URI: http://pixelstorm.com.au | |
Template: parent theme | |
Version: 1.0.0 | |
*/ | |
## cache busting enqueing | |
Setting 'parent-style' as a dependency will ensure that the child theme stylesheet loads after it. | |
Including the child theme version number ensures that you can bust cache also for the child theme. | |
<?php | |
function my_theme_enqueue_styles() { | |
$parent_style = 'parent-style'; // This is 'twentyfifteen-style' for the Twenty Fifteen 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' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment