122 PART II • Designing and Developing WordPress Themes
You need to add a Template line if you want the style sheet to declare that it is a child
theme, as follows. The template line contains the word Template: and the name of the folder in
which the parent theme resides:
Template: The name of the parent theme's folder goes here (child themes only)
Here’s the style.css file again, filled out with dummy content to fit the hypothetical Small
Notes child theme for the Notes Blog theme:
/*
Theme Name: Small Notes
Theme URI: http://tdh.me/wordpress/small-notes/
Description: This is Small Notes, a child theme for Notes Blog.
Author: Thord Daniel Hedengren
Author URI: http://tdh.me
Template: notes-blog
Version: 1.0
.
You need to have both Small Notes and Notes Blog in your wp-content/themes/
folder for this theme to work.
.
*/
Remember, this is the child theme’s style.css file. You can activate it just like a normal theme
from the Appearance page in the WordPress admin.
Now that you have your style sheet for the Small Notes child theme, you can change those
fonts and colors. First, you must decide whether to completely replace the parent theme’s
style.css file (Notes Blog in this case) or build on it. For this example, you will build on the
Notes Blog style.css, so you need to import the style sheet from Notes Blog. You do that with
the @import tag:
@import url("../notes-blog/style.css");
Add that line below the style.css theme header information and add anything you want to
alter below it. Change some colors and some fonts, just for fun:
@import url("../notes-blog/style.css");
div#content { font-family: Georgia, Times New Roman, serif; }
ul.sidebar { color: #444; }
Nothing fancy there, but you will have the font family starting with Georgia on everything in
the div with id="content", and the color of type in the ul.sidebar tag will be dark
gray. This will be read after everything in the style sheet from Notes Blog is read; @import is
declared and read first.
So the full style.css file for the Small Notes child theme, with the changes mentioned so far,
would look like this: