How to use Child Themes

Updated: August 17, 2016

Downloaded theme zip file include also ready to use child theme. If you prefer using child theme for your modifications, just install child theme from themeName-child.zip file the same way like standard parent theme. Zip file with Child theme is inside root directory of downloaded parent theme.

Child theme contains following files:

  • style.css – main CSS file of the child theme
  • custom.css – in this file you can write your custom CSS styles

You can copy template files from parent theme to child theme folder and modify them to your needs.

Example of main style.css file:

/*
Theme Name: Directory Plus Child Theme
Template: directory2
Version: 1.0
Author:
Author URI:
Description:
Tags:
License: GNU General Public License
License URI: http://www.gnu.org/licenses/gpl.html
*/

If your Parent Theme folder uses different name than default theme name downloaded from our club website, make sure please you have changed name of parent theme in part Template: directory2 to your theme name. For example if your theme is in folder ./wp-content/themes/myOwnThemeName you should change Template in child theme to:

Template: myOwnThemeName

Use of functions.php file

Child theme do not include functions.php file. If you would like to add some additional functions, create new functions.php file inside your child theme folder. Do not copy full content of functions.php file from your parent theme into functions.php file in child theme. Your new functions.php file should contain only your own additional codes.

The structure of functions.php file is simple. An opening PHP tag in the start of file, and your own php codes below it.

<?php // Opening PHP tag - do not insert any code or spaces before opening tag

// Your php code starts here