Customize your WordPress theme the right way with Child Themes

Customize your WordPress theme the right way with Child Themes

How to Customize a WordPress Theme

WordPress theme customization

You’ve searched hour upon hour for the perfect WordPress theme. You find one that is very close if you could only change this or that.

The problem is if you make changes directly to the theme files you won’t be able to update the theme without losing all your customizations.

The solution to this problem is to create a child theme. “With a child theme, you can update the parent theme (which might be important for security or functionality) and still keep your changes.”

What is a Child Theme

The WordPress codex explains the concept of child themes well…

“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.”

The child theme folder only needs to contain the style.css file, a functions.php file any other modified files.

TwentySeventeen Child Theme

First check if your theme comes with a child theme master zip file or if the theme author has provided a child theme on their website or github. If not you will need to create your own child theme.

If you’re looking for a child theme for the Twenty Seventeen theme, here’s one you can use.

  1. Download the free Twenty Seventeen Child Theme zip file.
  2. In your WordPress admin panel, go to Appearance -> Themes -> Add New -> Upload Theme -> Choose File.
  3. Browse your computer for the twentyseventeen-child.zip file downloaded in step 1 above.
  4. Click Open -> Install Now -> Activate.
Twenty Seventeen Child theme Download

How to Make a WordPress Child Theme

If you are looking to create your own child theme,  you will need to understand how to use an FTP client such as Filezilla and a file editor such as Komodo Edit.

Create a style.css file

  • Create a folder on your computer for your new website theme
  • Open Komodo Edit and create a new style.css file in your child theme folder
  • Open the style.css file and paste in the code below
/*
Theme Name: Your Theme Name
Theme URI: https://yourwebsite.com
Author: Your Name
Author URI: https://yourwebsite.com
Template: twentyseventeen
Description: Child theme for Twenty Seventeen.
Version: 0.1
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags:
Text Domain: twentyseventeen-child
*/
  • Edit the Theme name, website addresses and your name to give yourself credit as the theme author
  • Now create a functions.php file in the same folder with this code: starting with an opening php tag. The functions.php of a child theme does not override its counterpart from the parent.
<?php
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
  • Save both the style and functions files.
  • Open Filezilla and connect.
  • Create a new folder on the host server  in  ../wp-content/themes/child-theme-name. Use hyphens for spaces in the folder name and make sure it matches exactly with what you put Text Domain in the child theme style.css file.
  • upload the style.css and the functions.php files to the Child Theme folder
  • in the WordPress admin area go to Appearance -> Themes and activate your new theme.

You now have a child theme!

You can add your CSS changes to the style.css file of the Child Theme and they will take precedence over the parent theme’s styles.

“If you want to change more than just the stylesheet, your child theme can overwrite any file in the parent theme: simply include a file of the same name in the child theme directory, and it will overwrite the equivalent file in the parent theme directory.”

Copy a style block from the parent theme’s style.css file to your stylesheet, make your CSS change, save the file and FTP it back to the server.

For instance, you can copy the footer.php from the parent theme to the child theme, modify your copyright information, then upload the modified footer.php file back to the child theme folder.

There you go…You can now safely style and modify your WordPress theme!

Reference: WordPress Codex

Related Posts

If you liked this post, you might also be interested in one of these.
How to Adjust WordPress Blocks for Mobile Display
There's a Plugin for that....

6 thoughts on “Customize your WordPress theme the right way with Child Themes”

  1. Great Information.
    But i have a question, when we create a child theme and parent themes gets a new update. If we update the parent theme, does child theme also inherits the new updated features from parent theme???

    1. The child theme files don’t change. The child theme only contains any modified files-your modifications are preserved from being over-written. Sometimes when a parent theme updates you need to make edits to your child theme to account for the changes.

  2. I am new to blogging and in the process of building my site using the Omega child theme “Lifestyle”. Since it is already a child theme itself, is it still a good idea to make my own child theme of it before changing any code? I can’t seem to figure this out on my own, so thanks in advance for your help!

    1. Hi Natalie,

      Child themes are not meant to be used as a parent theme. I don’t think it is wise to make a child of a child theme but you can clone the child theme to make your own child of Omega. Change the name of its folder and theme name in style.css and customize it as you like from there as another child theme. You won’t get any of the child theme updates but your customizations will remain in place.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top