This is a short reference guide on making child themes and preparing them for development. I will come back to this guide and fill in some additional details.
Create a Location for your Child Theme
Go to the following…
- Add an Assets Folder
- Add the theme’s stylesheet
- file name: style.css
Every wordpress theme need this style.css file, and they need to begin with at least 2 specific comments. These comments are parsed by wordpress and used during installation.
A few other comments are also useful, but not necessary.
to the location:
Create & Import Everything in The Fuctions.php File
In the theme root, you should create a file called functions.php. We will add the following code:
Breaking Down the Enqueue Code
I want to make sure to keep all my child theme’s modifications actually within my child theme, so our functions.php file should start from the child theme’s root.
If you look at this WordPress example on how to include CSS and JS files (here and here), the code included will default to the parent theme’s root directory. In the second example, it’s a bit confusing because the code is filed under
Advanced Topics > Child Themes.
So, we’re going to use a different function to get the path of the child theme’s directory. We’ll be using: