What is a child theme in WordPress? Does your developer know?

30th August 2022

 If you have ever had to develop a WordPress website, you have surely had to deal with the child theme at least once.

If this has never happened before, we can already give you a spoiler: your site needs an immediate change, because we are talking about a fundamental functionality.

The child theme is in fact one of the best ways to manage the variations to the theme of your site in order to facilitate future maintenance, but above all in order not to risk losing all the changes you have made over time to the original theme.

Anything can happen when it comes to web development and unexpected events are always around the corner.

We don't want days and days of development work to be wiped out by a trivial accident, do we?

If you agree, then it's time to talk seriously about what a child theme is and why it is a fundamental feature of any serious portal or e-commerce.

What is a child theme?

A child theme or "child theme" is a theme that is created as a perfect copy of the main theme or "child theme". parent”, and which, like a backup, allows you to make changes and updates without losing elements of the original theme.

In essence, when creating the site you set a theme, the so-called theme parent. This theme, which is made up of individual files, will remain unchanged with all the content you created the first time.

Subsequent changes and additions will instead be applied to another set of data: the child theme, a perfect copy of the parent theme.

What is the child theme for?

In essence, the child theme is useful when the developers release a theme update and require the installation of new material on your site. The problem for those who do not have a child theme is that these changes overwrite existing files, thus risking erasing, for example, the changes that your developers had made over time. 

You may have written dozens of lines in CSS, and a simple update risks overwriting them!

For this reason, changes in CSS and PHP are made only on the WordPress child theme, and updates do not overwrite them, since they are only made on the parent theme, but complete them.

By doing this, you avoid any possible deletion of data.

How to Create a WordPress Child Theme

In some cases, the WordPress theme you are choosing already contains the dual theme. 

If the theme you have chosen does not explicitly declare this option, you (or your developer) will have to create a child theme from scratch.

Here are the two main ways to create a child theme:

1) Create a child theme via plugin

There is a plugin for almost everything, and child themes are no exception. With the Child Theme Configurator plugin, you can automatically create a child theme, without having to mess around with folders, code, and so on.

Unfortunately, this is not an optimal solution, which slows down the site's performance and allows for a slightly lower level of customization and intervention than the next option.

However, it has the advantage of being a very easy operation, because the plugin offers a sort of wizard for compilation and activation even for those who are not accustomed to web design.

In general, creating a child theme in WordPress via a plugin is recommended more for bloggers and private citizens, while a company that wants a serious site with competitive performance should turn to a developer, who will create the child theme in the manner we will see shortly. 

2) Creating a child theme in WordPress manually

To create the child theme folder:

  • Access the File Manager provided by the site hosting (alternatively you can go through FTP);
  • Access the root of the site;
  • Go to the wp-content>themes folder;
  • Create a folder that will contain your theme, which you can call for example “twentytwentytwo-child”. 

Creating the CSS file

After creating the folder it is time to insert the CSS file inside it. This contains all the information about the theme style, colors, spacing, shape and shadow of the page sections, font type and much more.

To create a CSS file:

  • Create a txt file using Text Edit (for those with Makintosh) and Notepad for others;
  • Change the file name to “style.css”, which also changes its extension;
  • Open the file with a text-editing program and paste the code into it:

/*

Theme Name: Twenty Twenty Two Child

Theme URI: http://example.com/

Description: Child theme for Twenty Twenty Two

Author: 

Author URI: http://example.com/about/

Template: twentytwentytwo

*/

  • Add the missing information in the text we have reported above;
  • Move the file to the wp-content/themes/twentytwentytwo-child (or /yourtheme-child) folder.

Creating the functions.php file

The stylesheet is created, it's time to style it the same as the parent theme. 

There are two ways:

1) Import

Today it is generally not recommended to import CSS, as this tends to degrade the performance of the site. 

2) Creating the functions file 

  • Create a file with Notepad or Text Edit;
  • Rename the file “functions.php”. 

Open the file with a text editor and paste this code:

 

<?php

add_action( 'wp_enqueue_scripts',

'enqueue_parent_theme_style' );

function enqueue_parent_theme_style() 

{

wp_enqueue_style( 'parent-style',

get_template_directory_uri().'/style.css' );

}

  • Move the file to the wp-content/themes/twentytwentytwo-child folder.

Activation via WordPress

WordPress It is the most popular CMS for a reason: it is convenient, fast and intuitive, and does not waste time wandering around looking for a function. In this case, to activate the files you have just created, simply access the WordPress dashboard of your new site, go to “Appearance” and then to “themes”.

All you have to do is select the theme you just created and installed. This will activate it and you will be able to start making the CSS and PHP changes you need on the child theme, without risking losing everything at the next update.

 

National: It is best to do a full backup before doing any of the operations listed in this guide!

 

Last tip: when you hear about php and css, a wave of despair has hit you? Maybe then it's time to turn to a developer, and avoid the most common beginner's mistake: deleting all the changes to the site, or worse, creating features that you don't know how to control and that make the site heavy and/or not very usable.

For a company, bad impressions are not allowed.

Contact Pizero!

More articles from our Tech Blog

May 7, 2025
Stripe Alternatives (with Lower Fees!)

It goes without saying that if Stripe has become one of the most used web payment methods, there is a reason. Stripe is in fact a reliable payment gateway, with modern APIs and that offers an optimal user experience, however its fees are not the lowest on the market. If you are looking for alternatives to Stripe, equally […]

14 April 2025
Most Interesting Tech Startups in 2025, Says Pizero!

The news seems to paint a triumph in every sector of businesses somehow linked to Artificial Intelligence. Let's not get carried away by easy enthusiasm: it is better to rely on data to outline the most interesting technological startups of 2025. Technological innovation is now a constant feature, at rates that 20 years ago would have been unthinkable, and […]

10 April 2025
RAG: What it is, how to implement it and why it will revolutionize your AI projects

RAG (Retrieval-Augmented Generation) is one of the most innovative technologies in artificial intelligence, combining the power of document search (retrieval) with the generative capabilities of the most advanced linguistic models, such as GPT-4. This combination allows for the creation of highly accurate, contextualized and up-to-date answers, making AI-based systems significantly more reliable. In this in-depth […]

24 March 2025
What is a VPN and Why You Might Need One (Updated 2025)

Need to connect to your company server? Get around an IP block (for ethical reasons, of course)? Or just make sure the connection you’re browsing on keeps your data safe? For any of these cases, and many more, a VPN is the technology you need. If you’ve heard of it and […]

Request a meeting

Fill out the form to get a personalized consultation for your project.

Fill in the fields to be contacted

© Pizero Design srl, all rights reserved - PI 02313970465 - REA LU-215417
X
lockuserscartcalendar-fullsmartphonelaptopbriefcase