Actually we deal with a single question per QA, but the basic of them can be clarified in a simple manner, we can proceed in this way:
First of all let me create a rudimentary child theme of Fukasawa for you.
I made a folder inside themes/
folder, named something
. Inside the folder I made a style.css
with the following content:
/**
* Theme Name: whatever
* Template: fukasawa
*/
And then I made another file inside the folder named functions.php
and added the following content:
<?php
function theme_enqueue_styles() {
wp_enqueue_style( 'kauwa-style', get_template_directory_uri() .'/style.css' );
}
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
In my /wp-admin/themes.php
now I’ve got a theme named “whatever”, and activated it as a child theme of Fukasawa.
Answers:
A child theme works on the folder name of the parent theme, in this case it was fukasawa
and that what we mentioned in template
in stylesheet.
TESTING TESTING: Rename the folder from
fukasawa
tofuakasawa-kauwa
and in yourstyle.css
do the same intemplate
directivefukasawa-kauwa
, you can see the your child theme still works. 😉
The style.css
is the base of a child theme. We then added the functions.php
to add the parent theme’s stylesheet into our theme. Q4 – you can see I changed the handle’s name to something odd. So you got your answer I guess. 🙂
I’m not answering Q1 and Q2 because both of them are not related to child theme things.
Enqueuing your theme’s resources:
We don’t require to load the child theme’s stylesheet again, because it’s already read by WordPress. Thanks to Pieter for pointing that out. But you need to be clear about one thing: as you are dealing with parent theme’s features, so you have to mention that you are trying to load something from your child theme, not from the parent. And a way of doing this is to use the get_stylesheet_directory_uri()
, it says WP to load things from the Child theme, not from its parent.