The Concept of Child Themes

WordPress, by default, supports child themes. Child themes look exactly like their parent themes, unless you make modifications to them. Child themes inherit all the templates, functions, and CSS of parent themes. This compartmentalizes variations so that you can make changes without affecting the integrity of the parent theme.

A child theme is usually contained in a folder having a styles.css (required) and afunctions.php file. functions.php is not mandatory, but you will need it if you want to include some custom functions on top of your parent theme (which, in this scenario, is the WordPress theme framework). Both the child theme and parent theme folders will be in the themes directory of your WordPress installation.

You can override the inherited traits from its parent by modifying its own styles.css andfunctions.php files.

Here is how you declare a child theme (this goes inside styles.css, at the top).

/*  
Theme Name: Child Theme
Theme URI: http://sixrevisions.com
Description: A child theme description.
Author: Saad Bassi
Author URI: http://addictivefonts.com/
Template: My Framework (e.g thematic or Hybrid)
Version: 1.0
Tags: theme
*/

The Template attribute above instructs the WordPress core to inherit all the templates of “My Framework,” which is the name of the parent theme in our hypothetical scenario.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s