Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?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