Working with Child-Themes

A WordPress child theme is a theme that inherits the functionality of another theme, called the parent theme, and allows you to modify, or add to, the functionality of that parent theme. A child theme is the safest and easiest way to modify an existing theme, whether you want to make a few tiny changes or extensive changes. Instead of modifying the theme files directly, you can create a child theme. A child theme inherits all of the templates and functionality from its parent theme, but allows you to make changes to the parent theme because code in the child theme overwrites code in the parent theme.

Why use a Child Theme?

If you want to modify an existing theme, it is better to do it by creating a child theme than by modifying the parent theme directly. There are several reasons to use child themes:

How to Create a Child Theme

Create a directory in your themes directory to hold the child theme. The themes directory is wp-content/themes. You can name the directory whatever you want, but it is common practice to use the name of the parent theme folder with “-child” appended to it. So, for instance, if you are making a child of the twentytwelve theme, your folder name would be twentytwelve-child.

In the child theme directory, create a file called style.css. This is the only file required to make a child theme. The style sheet must start with the following lines:

    /*
    Theme Name: StartUp-Child
    Theme URI:
    Description: StartUp child theme
    Author: John Doe
    Version: 1.0.0
    Template: im-startup
    */

    /* Main theme styles */
    @import url('../wp-content/themes/im-startup/assets/css/extensions/packed.css');
    @import url('../wp-content/themes/im-startup/assets/css/fonts/packed.css');
    @import url('../wp-content/themes/im-startup/assets/css/generic/packed.css');
    @import url('../wp-content/themes/im-startup/assets/css/responsive/packed.css');

    /* Importing dynamic stylesheet */
    @import('/?cssgenerator=ux');
    @import('/?cssgenerator=custom');