WordPress Child Theme

What is a WordPress Child Theme, and when do I need it?

What is a WordPress Child Theme? If you’ve been in the WordPress world for a long time, you’ve probably heard the term “Child Theme”. It’s become one of those scary, complex things that many users try to avoid without really knowing anything about it.

In reality, however, it is not as scary as it seems at first glance. In fact, it’s even pretty easy to understand and use. But what is a Child Theme really? What does it do? Do I need a Child Theme? What do I need it for?

In this post, I will answer some of these basic questions and give a step-by-step guide to create one.

What is a WordPress Child Theme?

These child themes offer designers and developers the opportunity to create new designs that inherit the functionality of the parent theme.

Child themes make it possible to customize the parent theme itself without touching the core files. As a result, it protects these adjustments during updating the parent theme. However, child themes are becoming increasingly popular in stores for the reasons mentioned above.

Child themes are mostly used for:

  • Custom CSS and Javacript
  • To add or edit PHP functions in the functions.phpfile

Types of Child Themes

Technically, there is only one type of child themes. It is always an extension of the parent theme and inherits the design and functions.

Nevertheless, I would like to point out two different types of use, which repeatedly cause confusion.

1. Child Theme to Customize

So-called naked child themes are only used for adjustments and additional functions of your own theme, so that any changes will not be lost during making an update.

2. Child Themes for Sale

Child themes for sale often fundamentally change the look of the parent theme.

A prime example of this is the well-known Divi Theme. Many theme developers have specialized in developing their own themes that are based on Divi. So you also buy a product that has been specially adapted for photographers or lawyers.

Do I need a Child Theme?

It depends!

Yes

You need a child theme if you want to change files of your theme.

If you have to make a lot of CSS adjustments, there’s no better way than having a decent editor right in the style.css.

It is equal if you constantly have to insert new code for your functions.php file. You can also do this with plugins like Advanced Scripts, but nobody really wants to program it.

In such a case, you absolutely need a child theme!

No

You don’t need a child theme if you don’t change your theme’s files.

If you are no programmer and can’t do anything with CSS and PHP anyway, you probably never will have to or want to change a file of your theme.

Modern WordPress themes already bring immense design possibilities with themselves, so that no code has to be used anymore.

In this case, you don’t need a child theme either!

NEW: Our WordPress Child Theme Generator

Alternatives to the Child Theme

I already have mentioned it above: adaptable themes will soon make this technology a discontinued model. At least for non-developers.

1. Customizer

The WordPress Customizer
The WordPress Customizer

The Customizer is the standardized settings system for WordPress themes.

In the past, all developers had relied on their own panels. Today, anyone can extend this customizer and adapt it to their theme. This is a real blessing for the end-user.

The customizer replaces many tasks that the child themes had previously taken over.

2. Plugins for code snippets

Anvanced Scripts Plugin
Anvanced Scripts Plugin

Filters and actions must be in the functions.php file of your theme. At least that’s how it was …

… For small code snippets, plugins such as Advanced Scripts or Code Snippets are also ideal.

At least for my customers, I use such plugins with which they can deactivate code created by me themselves if necessary.

Create WordPress Child Theme Yourself

Even though creating the template may be a bit intimidating at first, it’s actually very simple. Nevertheless, I have fanned out the process in six steps so that there really are no questions left.

1. Create child theme directory

Create a new directory on your desktop and give it any name, like:

  • parentname-child
  • Domain name

Common practice is to use the name of the Parant theme and hang “-child” on it. Or simply the name of the domain on which the theme is used.

Attention: Do not use spaces, special characters or umlauts.

2. Create style.css

For the function, really only one file is necessary and that is the inconspicuous"style.css".

Create a new file called style.css in a previously created folder, open it, and paste the following code:

/*
 Theme Name: twentytwentyone Child
 Theme URI: https://bloggerpilot.com/wordpress-child-theme/
 Description: twentytwentyone Child Theme
 Author: Jochen Gererstorfer
 Author URI: https://bloggerpilot.com/
 Template: twentytwentyone
 Version: 1.0.0

Text Domain: twentytwentyone
*/

/**
 * Add your custom CSS here
 */

Here almost all information is free to choose. Only the specification after “Template:” must contain the directory name of the child theme, otherwise it will not work.

3. Create functions.php

If you create a child theme, you will probably also need a functions.php. You can now also create this file in the previously created directory.

<?php
/**
 * Enqueue child styles.
 */
function j0e_enqueue_styles() {
	wp_enqueue_style( 'child-theme', get_stylesheet_directory_uri() . '/style.css', array(), 100 );
}

add_action( 'wp_enqueue_scripts', 'j0e_enqueue_styles' );

/**
 * Add custom functions here
 */

If your parent theme uses a function starting with “get_stylesheet” to load the styles, its style.css must also be loaded.

4. Create screenshot.php

The screenshot is optimal and does not need to be inserted.

Create a screenshot of your theme and save it in the same directory as screenshot.png.

The size should be 1200 px x 900 px.

5. Install Child Theme

You now have two options to install your theme:

Upload via FTP

Child Theme Upload with FileZilla FTP
Upload with FileZilla FTP

Connect to your web space with your FTP tool and create a new subdirectory with your desired name in the /wp-content/themes/ directory.

Then upload the three previously created files to this directory. Just as can be seen on the screenshot above.

You thought creating WordPress Child Theme is hard?

Upload in WordPress Admin

Install Child Theme in WordPress Admin.
Install Child Theme in WordPress Admin.

Alternatively, you can put the previously created folder with the three files in a ZIP archive and upload it in the WordPress Admin.

Change to the menu Design > Themes > Theme and then click on “Upload Theme”. Then you select your .zip file and click on “Install now”.

Tip: You need a change of scenery? This is how you make a theme change.

6. Activate New WordPress Child Theme

to activate

In the last step you have to activate your new template.

Change to Design > Theme and click on the gray button “Activate“.

ready!

Apply adjustments from the parent theme

Customizer Import and Export

If you have already made adjustments for the parent theme, and you activate a child’s theme afterwards, you lose them because they were stored in the database for the parent theme. Therefore, it is also advisable to always rely on this function right at the beginning.

So that you do not have to start all over again, you can use the free plugin Customizer Export/Import to export all Customizer settings in the parent and import them again in the child.

After the plugin installation can be found directly in the customizer.

WordPress Child Themes Downloades

What is the difference between a theme and a child theme?

A WordPress theme includes all the necessary PHP files, CSS files and JS files necessary for the operation of a website.

A WordPress child theme, on the other hand, always needs the parent theme and a single file called style.css. This theme is not functional on its own.

Child Theme Configurator and Generator

I would rather keep my hands off generators. Often unnecessary files, or even malicious code, are packed with it.

Create your child theme yourself or download it from a trusted source like here, or directly from the developer.

Note at Child Themes!

Never forget: A WordPress Child Theme is always just an extension to the Parent Theme.

So you must never delete the parent main theme, otherwise your child theme will not work either.

You can find out more on the technical and English page of WordPress Developers.

Conclusion

I always use a WordPress child theme because I’ve always been so used to it and because I can handle it too. As a developer, I appreciate the advantages of a child theme.

If you have a great theme where you can do all the settings in the customizer, you don’t need one!

Leave a Reply

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