Skip to content

Instantly share code, notes, and snippets.

@2shrestha22
Created January 6, 2017 09:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 2shrestha22/822eb75b918d3452faf79ef6dc7a88b0 to your computer and use it in GitHub Desktop.
Save 2shrestha22/822eb75b918d3452faf79ef6dc7a88b0 to your computer and use it in GitHub Desktop.
<?php
/* An example of enqueuing a child theme.... xyz=your parent theme direcrtory name, you can find it in wp-content/themes/ directory. */
//***********************
function enqueue_my_styles() {
$parent_style = 'xyz-style';
// Gives value of variable xyz
wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
// To enqueue parent theme css
wp_enqueue_style( 'xyz-child-style',
get_stylesheet_directory_uri() . '/style.css',
array( $parent_style )
);
// To enqueue child theme css
/* If your theme has stylesheets other than style.css you should enqueue them also, /css folder may also contain rtl.css, editor-style.css and ie.cs, they will be loaded automatically if needed so we don't need to enqueue them.*/
}
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles' );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment