Created
January 17, 2017 04:09
-
-
Save edward-jimenez/2b3eac6ca0da8e5ab19d8a5271bece77 to your computer and use it in GitHub Desktop.
WordPress recommended method for child theme creation
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
<?php | |
/* | |
In your functions.php file on the child theme, enter the following code | |
*/ | |
function prefix_theme_enqueue_styles() { | |
$parent_style = 'parent-style'; // style.css of the parent 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', 'prefix_theme_enqueue_styles' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment