[sociallocker ]

How to Enqueue WordPress Child Theme Style Sheet

More videos
PluginForage.com Member

Enqueue a WordPress Child Theme Style Sheet

Note: For an in-depth video on how to create a child theme for WordPress, view my video “How to Create a WordPress Child Theme” Just note that you should ignore the @import method shown in that video and use the enqueue method shown in this video.

Find out where your website ranks with your chosen keywords in Google, Yahoo and Bing.
14 day free trial. No credit card required.

We will look learn how to Enqueue a WordPress child theme:

Premium WooCommerce Extensions, WordPress Plugins & Themes Only $10 or Free with Membership

– Look at the old @import method
– Create a functions.php
– Enqueue the parent and child style.css

Code snippet used in this video: enqueue_code_snippet

Why use a Child Theme?

There are a few reasons why you would want to use a child theme:

  • If you modify a theme directly and it is updated, then your modifications may be lost. By using a child theme you will ensure that your modifications are preserved.
  • Using a child theme can speed up development time.
  • Using a child theme is a great way to learn about WordPress theme development.

The first step in creating a child theme is to create the child theme directory, which will be placed in wp-content/themes. It is recommended (though not required, especially if you’re creating a theme for public use) that the name of your child theme directory is appended with ‘-child’. You will also want to make sure that there are no spaces in your child theme directory name, which may result in errors.

The final step is to enqueue the parent and child theme stylesheets. Note that the previous method was to import the parent theme stylesheet using @import: this is no longer best practice. The correct method of enqueuing the parent theme stylesheet is to add a wp_enqueue_scripts action and use wp_enqueue_style() in your child theme’s functions.php. You will therefore need to create a functions.php in your child theme directory.


WordPress Codex Child Theme

Young Man Holding Blank Placard

Premium WooCommerce Extensions, WordPress Plugins & Themes Only $10 or Free with Membership

Learn more advanced WordPress development techniques:

WordPress: Custom Post Types and Taxonomies


Share your thoughts!