Top

How to Create a WordPress Child Theme in 3 Steps

November 16, 2010

When creating a theme for your WordPress site, one of the most important ways to ensure that you can receive regular updates is to learn how to use parent and child themes. Child theme support has been greatly improved with WordPress 3.0 and it’s highly encouraged when customizing a theme for your site. Read on and we’ll get you up to speed with the latest best practices for WordPress theming.

What is a Child Theme?

A child theme inherits the functionality of a parent theme, which usually holds the base for the layout, structure, function and basic style. A child theme expands upon or modifies the parent theme within a separate set of files. It keeps all of your customizations in their own folder.

Why Create a Child Theme?

The most important reason to have a child theme is so that the parent theme can be updated without overwriting your child theme. All of the specific customizations you’ve made for your site will be preserved within the child theme. 

3 Steps to Creating a Child Theme

Creating a child theme is very easy. You can do it with a basic knowledge of using FTP to transfer files. 

Step 1: Create a Folder in the wp-content/themes directory for your theme.

It’s important to note that your child theme does not go inside of the parent theme directory. Rather, the child theme lives side by side in the same directory as the parent theme.

Step 2: Add a style.css file with the theme information.

In the very least your child theme needs to have a stylesheet. Other files such as functions.php or template files are optional, depending on how much you want to customize your theme.

The only requirement for your style.css file is that you include the theme information at the top. Here’s an example of the header information for a Twenty Ten child theme: 

/*
Theme Name:     Twenty Ten Child
Theme URI:      http: //example.com/
Description:    Child theme for the Twenty Ten theme
Author:         Your name here
Author URI:     http: //example.com/about/
Template:       twentyten
Version:        0.1.0
*/

Important Note: The parent theme’s style.css will not be loaded if you have a child theme. If you want to use the parent theme stylesheet and build upon it in the child theme, you’ll need to import its parent theme stylesheet. The import rule looks like this and you should place it directly under the child theme’s header:

@import url("../twentyten/style.css");

Now, anytime you want to modify the parent theme, you’ll simply add a copy of the specific file you want to change to your child theme directory. You will then make your modifications to files that are in the child theme directory.

For example, if you want to change the sidebar.php file, you can either start from scratch or grab a copy from the parent theme and upload it to the child theme directory.

Step 3: Activate your Child Theme!

You will need to activate your theme just like you would any other theme. Go to Dashbaord >> Appearance >> Themes and activate your new theme. That’s all you need to do in order to start using child themes.

Parent and child themes might sound complicated if you’ve never used them before, but the process is actually quite simple.You can add your own child theme in minutes. This is a quick tutorial to get you off the ground, but with a little bit of knowledge about how WordPress templates work, you’ll be able to do virtually anything you want with child themes.

Tweet This Post

This theme is provided free of charge, provided you leave the "Wordpress Theme From Pressography.com" attribution link at the bottom of the theme.

If you want to remove the attribution link, you must pay a small, $10 license fee for each site on which you want to remove the link. Click Here For More Information

Comments

Got something to say?

Bottom
Article Archive  |  This site is a historical archive of pressography.com, a WordPress plugin and theme blog that published between 2006 and 2012. It is preserved for reference and is not operated by, affiliated with, or endorsed by its original authors. Nothing here is for sale and no form on this site is active. If you are the original owner and would like this domain returned, please get in touch.