Created
August 2, 2016 05:59
-
-
Save maddisondesigns/43ad1f273135a45823f0075f139ef746 to your computer and use it in GitHub Desktop.
WordPress Child Theme Example
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
<?php | |
function mytheme_scripts_styles() { | |
// Enqueue the parent theme stylesheet | |
wp_enqueue_style( 'parent-style', trailingslashit( get_template_directory_uri() ) . 'style.css' ); | |
// Ensure the default WordPress stylesheet is enqueued after the parent stylesheet | |
wp_enqueue_style( 'style', get_stylesheet_uri(), array( 'parent-style' ) ); | |
} | |
add_action( 'wp_enqueue_scripts', 'mytheme_scripts_styles' ); |
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
/* | |
Theme Name: Your Child Theme Name | |
Theme URI: http://example.com/my-awesome-child-theme | |
Description: A description for your Child Theme | |
Author: Your name | |
Author URI: http://example.com | |
Template: parent-theme-folder-name | |
Version: 1.0.0 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Pro Tip:
When adding the above code to your style.css file, don't forget to update the Template name.
Although not technically needed for it to work, it’s a good idea to also create a .png image (screenshot.png) to display a screenshot on the Themes page in the Dashboard. The image should be 1200 x 900px.