Skip to content

Instantly share code, notes, and snippets.

@edward-jimenez
Created January 17, 2017 04:09
Show Gist options
  • Save edward-jimenez/2b3eac6ca0da8e5ab19d8a5271bece77 to your computer and use it in GitHub Desktop.
Save edward-jimenez/2b3eac6ca0da8e5ab19d8a5271bece77 to your computer and use it in GitHub Desktop.
WordPress recommended method for child theme creation
<?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