WordPress: Create child theme

October 11, 2018 Coding, Tips, Wordpress

Have you ever wondered how to create a child theme for your WordPress website? Actually it’s pretty simple, but first:

What is a child theme?

A child theme is a them which inherits everything from another one (logic and appearance) which can override (and so personalized) parts of it.

Where to start?

You have two methods to go for.

  1. Use a WordPress plugin.
  2. Use your coding skills.

Using a plugin

We always discourage using plugins for easy stuff as a plugin can be bugged and create backdoors on your website and also having many plugins can slow down your website.

If you do not care we suggest you to download the plugin with the best feedbacks based on a big number of installations. 

We found this one which seems to have a good rating but we didn’t try it: https://it.wordpress.org/plugins/child-theme-configurator/

By code

Create a child theme by code is the way we do suggest.

Also it is pretty simple. What you need to do is just:

  1. Locate the wp-content/themes folder on your WordPress project.
  2. Create a folder which will represents your theme.
  3. Name the folder like your theme but use lowercase letters, no spaces, no underscores. If your theme is called My Super Theme the folder should be mysupertheme .
  4. Create the style.css file inside the theme folder. Every theme must have this file.
  5. Place the following lines of code into your style.css file:
/*
Theme Name:     <Your theme name>
Description:    <Your theme description>
Author:         <Your name>
Template:       <Parent theme name>
*/

Let’s, for example, create our My Super Theme theme which inherits from the WordPress Twenty Thirteen theme.

This is the code to place into the style.css:

/*
Theme Name:     My Super Theme
Description:    This is My Super Theme
Author:         Thomas Cocchiara
Template:       twentythirteen
*/

NOTE: Template is twentythirteen and not Twenty thirteen because you should put the Parente Template folder name and not the Template Name.

Hope this little guide could help you.

Please leave us some feedback and share 😉