You are invited to Log in or Register a free Frihost Account!

WP Child Theme

Quite a number of people probably wonder what a Child Theme is in Word Press and how it is created. It's not as difficult as it sounds. Quite often we would like to make changes to the WordPress theme, so if we were to do it with the CSS, templates and functions files of the theme, there is a great chance that we could break the theme and our Website. A child theme is a theme that is based on the parent theme but stands on its own. It consists of a child theme folder we create ourselves, with our own styles.css file and functions.php. If we should make a mess of things in the child theme styles.css, we can always fall back on the parent theme, or on earlier backups of the child theme.

Most serious WordPress theme authors have child themes bundled in with their theme, but if there isn't a child theme with your theme, it is very easy to create it:

1. Go into your cPanel and with the File Manager create a folder in your WordPress Themes Sub-Directory (in WP Content Folder) called "Theme Name" Child Theme.

2. Then within the Child Theme folder create a styles.css file. One can do that with the code function in cPanel File Manager.

3. Open the styles.css file of the Parent Theme and copy the commented (/*) portion only to your Child Theme styles.css document. It will look like this:

4. Change the description of the theme (Item 4) and the name of the template (Item 9).

5. Then at the bottom of the comment after "*/" in a new line add this line:

@import url(.../"parent theme name"/styles.css");

6. Finally one has to go into the WordPress DashBoard themes to activate the child theme. The child theme will look exactly as the parent theme, until changes are made to the styles.css. All of these changes are made below the import line of the Child Theme styles.css - including the templates. The template code that changes is made to is copied at the bottom of the styles.css, and modifications made to it.

Here is a video tutorial of how to create a child theme in which it explains how to create a child theme with the assistance of a Child Theme Plugin - One-Click Child Theme:

0 blog comments below

© 2005-2011 Frihost, forums powered by phpBB.