ToolBox -

 

Creating a child theme allows you to start with any theme and make your own changes without modifying the parent.  This allows safe upgrading of the parent without affecting your work, for example.

At its simplest, creating a child theme requires creating a new child-theme folder in the themes directory, and a style.css file that invokes the parent CSS file.  Anything you place in the child css will supplement or override the parent style.

Justin Tadlock's full tutorial is here.

The setup is like so:

 "WordPress Child Themes are located in /wp-content/themes/ like any other WordPress Theme. They’re activated from the WordPress admin like any other theme. They’ll always have a style.css file and may often include a functions.php file. They can contain images folders, script folders and include folders . . . except they don’t need theme files. None at all. Zero. You don’t need to understand PHP in the slightest to create a WordPress Child theme."

……  From WordPress Codex, a sample style.css header . . . 

01 /*
02 Theme Name: Rose
03 Theme URI: the-theme's-homepage
04 Description: a-brief-description
05 Author: your-name
06 Author URI: your-URI
07 Template: use-this-to-define-a-parent-theme--optional
08 Version: a-number--optional
09 .
10 General comments/License Statement if any.
11 .
12 */

"We’ll be concerning ourselves with 1 particular line from the style sheet header.

7 Template: use-this-to-define-a-parent-theme--optional

Let’s make a WordPress Child Theme for one of the featured themes on the WordPress Theme directory, Fusion. We’ll call our new Child Theme, Fission. But first, a warning: this will be really easy.

We need to make an appropriately named directory in /wp-content/themes/ for our new Child Theme. That gives us /wp-content/themes/fission/.

In that /fission/ directory create a new file called style.css. Open style.css up in your favorite text editor.

Copy the following 5-line style sheet header into style.css and save the file. Pay close attention to line 4.

1 /*
2 Theme Name: Fission
3 Description: A Child Theme of Fusion
4 Template: fusion
5 */

Now, we’re going to import the styles from the Parent Theme by adding only 1 line to our Child Themestyle.css.

1 /*
2 Theme Name: Fission
3 Description: A Child Theme of Fusion
4 Template: fusion
5 */
6 @import url(../fusion/style.css);

 

And then customize . . .  ie . . .

1 /* Overriding the h2 styles from the Parent Theme */
2 h2 {
3     font-family:"Palatino Linotype",Georgia,"Tahoma","Century Schoolbook L",Arial,Helvetica;
4     font-size:250%/* Increasing the font size */
5     font-weight:bold/* Making the titles bold */
6     margin:0.6em 0 0.3em;
7 }

 

What happens when you really do need to make changes to a template file? When there’s something hardcoded in?

Easy. Copy the Parent Theme template file to your Child Theme directory and make the edits there. As of version 2.7, WordPress will look in the Child Theme directory first for template files. And if an alternate version of, say, footer.php, or single.php exists, WordPress will use that template file instead. This is simply awesome. WordPress will even accept category-XX.php (where XX is the ID of a particular category) in a Child Theme if you want to make changes to a specific category archive.