Using a child-theme in wordpress 4.9.x

Using a child-theme is very useful.

All the pretty customizations you‘ve  done on an existent WordPress-Theme will be deleted in this „special“ moment, when you update a theme in your wordpress-backend. Aaaaargh! So if you wanna keep this customizations for just a bit longer – you need to be prepared in a special way. Building and installing of a child-theme is one of them, very simple and saves you a lot of time, work and prevents easily making too many things twice.

So how do we start in building a so called „Child-theme“ of a WordPress-theme?

First we identify the name of the existing theme. This will be the „Parent theme“
Then first we need a new „theme“ – folder ( for the child-theme) in the same location as the existing theme with the name f.i. „themename-child“.

In this folder we create only 2 needed  files.
First we name a file „style.css“, in this file the wordpress engine will find the information about the „Parent-Theme“ related to your „Child-Theme“. You can do that with a simple textfile.

Theme Name: „The-name-of-your-existing-Theme“ Child
Description: Mein Child Theme (or whatever you wanna tell the people outthere)
Author: Your name
Author URI:
Template: The-name-of-your-existing-Theme
Version: 1.0
Text Domain: „The-name-of-your-existing-Theme“-child
Ready. Save it under the name style.css.

The second thing to do is a file called „functions.php“. Therein we will tell the WordPress where the „Parent-theme“ is and whats to do.

* Child theme stylesheet einbinden in Abhängigkeit vom Original-Stylesheet

function child_theme_styles() {
wp_enqueue_style( ‚parent-style‘, get_template_directory_uri() . ‚/style.css‘ );
wp_enqueue_style( ‚child-theme-css‘, get_stylesheet_directory_uri() .’/style.css‘ , array(‚parent-style‘));

add_action( ‚wp_enqueue_scripts‘, ‚child_theme_styles‘ );

After doing this you have to choose the „Child-theme“ in the DESIGN > THEMES settings of your WordPress-Backend.

Whats to do, when you already have used the built-in customizer of wordpress?

  1. Dont worry – you only need to install a plugin called „Plugin Customizer Export/Import“ to save your existing customizer-settings to your desktop before switching to a child-theme. (this file is saved in a .dat-format. When this is done, switch to the Child-theme and import those settings in the built-in Customizer of the wordpress installation.