Skip to content

Instantly share code, notes, and snippets.

@mor10
Created July 11, 2016 20:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mor10/f2ec3d344331b0789942636248a7ef53 to your computer and use it in GitHub Desktop.
Save mor10/f2ec3d344331b0789942636248a7ef53 to your computer and use it in GitHub Desktop.
Alternative method for adding parent theme stylesheet to WordPress child theme
<?php
// Enqueue the parent theme stylesheet, then the child theme stylesheet.
// Used in place of @import rule in child theme style.css
function child_theme_name_enqueue_styles() {
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' ) );
}
add_action( 'wp_enqueue_scripts', 'child_theme_name_enqueue_styles' );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment