Menu
Disclosure: ULTIDA's content is free & reader-supported. We may earn a commission if you click & buy through our links. Your support helps us create the best content & make a difference.
Tutorials

What Is A WordPress Child Theme? (Pros & Cons)

what is a wordpress child theme

Have you ever questioned what is a WordPress child theme exactly? And when should you use it? Are there any pros and cons to it?

I did several times when starting in WP.

And those are some of the questions we go from you that we will answer in this post.

One of the best things about WordPress is the sheer number of themes available for it.

But, no matter HOW MUCH you may like a specific theme, there might be a situation where you want to change a few style settings or add a particular feature that you cannot add through the theme settings.

If you’re not careful and add those modifications directly to your theme, they’ll get overridden when a theme update comes around.

That’s why it’s much better to use a WordPress child theme.

What Is A Child Theme In WordPress?

According to the official definition from the WordPress Codex, a WordPress child theme is a theme that “inherits the functionality and styling of another theme, called the parent theme.”

WordPress child themes are used to make modifications to the parent theme without actually altering the parent theme itself.

This allows you to PRESERVE your changes even if your WordPress parent theme gets updated as the changes won’t get overridden by the update. (Very convenient!)

From a user’s point of view, they’re free to make modifications to the theme such as changing styles or adding new functionality.

For designers and developers, child themes allow them to quickly create a bunch of different styles and designs based on a robust and reliable theme without coding everything from scratch. (Saves heaps of time.)

When Should You Use a WordPress Child Theme?

So now that you know what a WordPress child theme is, you might be wondering when you should actually use one.

The answer is: it depends on your needs. (How boring is this answer from 1 to 10?)

Here’s more.

If you’re happy with your current WordPress theme and you don’t foresee yourself making changes to it, you probably DON’T HAVE to use a child theme.

But, if you find yourself constantly modifying your theme’s style.css or functions.php file, you’d be better off creating a child theme and applying your modifications to the child theme.

This allows you to customize the theme to your heart’s content without the risk of losing all your hard work when the theme updates.

Pros and Cons of Using Child Themes

As with anything else, there are pros and cons to using a WordPress child theme.

Here’s what you need to consider before creating and using a child theme for your WordPress website.

WordPress child themes pros:

  • You can safely update your parent theme without the fear of losing updates and modifications you applied to the child theme. That’s because with a child theme, you never have to modify the parent theme’s files.
  • If you’re using a framework as the parent theme, you can have a great deal of flexibility in your child theme without adding a lot of your own code. Another benefit of using a framework is that you can easily add new functionality and modify only the template files you need.
  • You don’t have to think about all the possible scenarios in your child theme. You can rely on the parent theme to provide the features and functionality you need.

WordPress child theme cons:

  • You’ll need to spend some time getting familiar with the parent theme or the framework you’re creating the child theme for. Not to mention, there’s also the learning curve involved with working with more robust themes and frameworks.
  • Your parent theme’s developers may decide to stop supporting the theme in the future and abandon it altogether. Or they might drop a feature that you were using in your child theme. In that case, you’ll need to get more familiar with coding or you’ll need to find a new parent theme.

How to Create a WordPress Child Theme

Creating a child theme is not at all difficult.

First, you need to create a folder for your child theme in your themes directory.

You can find it at wp-content/themes.

For best practices, you should name your child theme the same as your parent theme with the word -child appended at the end. (Organizations matter!)

So for example, if you’re creating a child theme for TwentyTwenty theme, you’d name the theme and the folder twentytwenty-child.

The next step is to create a style.css file.

This stylesheet will contain all of the CSS rules and declarations that you’ll add to customize the look of your theme.

This file should also include the following comments at the top of the file:

/*
Theme Name: Twenty Twenty Child
Theme URL: http://yourdomain.com
Description: Twenty Twenty Child
Theme Author: Your Name
Author URL: http://yourdomain.com
Template: twentytwenty
Version: 1.0.0
Text Domain: twentytwenty-child
*/

The last step is to enqueue the parent and child theme stylesheets.

For this, you’ll need to create the functions.php file for your child theme and add the following lines to it:

<?php
add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );
function enqueue_parent_styles() {
   wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
}
?>

The last step is to activate your child theme by going to your WordPress dashboard and navigating to Appearance > Themes.

Activate the child theme you’ve just created, and you’ll see that it looks the same as the parent theme.

You can now customize it HOWEVER YOU WANT. In other words, make your dream website or blog.

Final Thoughts

A WordPress child theme is useful if you want to edit your WordPress theme safely and without the fear of losing all your updates and modifications when a theme update rolls around.

With the tips in this article, you’ll be able to CREATE and USE a WordPress child theme to make stylistic changes to your website.

The only thing left to do now is to choose a good parent theme and get to work.

Good luck!

No Comments

    Leave a Reply