How to Create a Child theme in WordPress: Step by Step Guide

0.00
19:39
937
Related CMS:

WordPress is a playground for people who love experimenting and want to take matters in their hands. The platform is easy to customize and play with, such that you can tailor made your website according to your needs and preferences.

And one amazing way to play with the looks and layout of your website is my customizing your WordPress theme by using a child theme. This way, all the customizations that you do would be saved in a different folder, and they would not get lost when you update the parent theme.

What is Meant by Child Theme?

For uninitiated, child theme is the mirror reflection of the original or parent theme. Thus, no matter what changes you make on your child theme, your parent theme will not reflect them. However, if any changes are made by the parent theme, those changes will reflect in your child theme.

What Are The Benefits Of Using A WordPress Child Theme?

If you want to modify your existing theme, using child themes to do so is one of the best and safest ways.

This way, even if your parent theme gets updates, your changes would not be deleted.

Further, if your child theme starts throwing errors, you can always disable it and move ahead with the parent theme.

But how to create a child theme in WordPress? Let’s find out.

Setting Up a WordPress Child Theme

There are two ways through which you can set up a WordPress child theme, and these include:

  • Creating a child theme using plugins
  • Developing a child theme manually

How to Make a Child Theme in WordPress Using Plugins?

There are various free WordPress plugins which can help you in creating child themes. Some of these plugins include Child Theme Creator, Child theme Configurator and various others.

Here are the steps that you need to follow

  • Login to your WordPress dashboard
  • Download the child theme plugin of your choice
  • On the left navigation pane, navigate to Plugins > Add New
  • Next, click on Upload Plugin > Activate Plugin
  • Now, head on to Appearance > Themes. Here make sure that the theme you want to create the child theme for is activated
  • Click on the respective thumbnail of the theme and click on child theme
  • Once you do this, you will be redirected to a child theme configurator page wherein you can add details to your child theme like description, theme name and so on,
  • Next, click on Create Child, and this way, your child theme will get activated in no time.

How to Make a Child Theme WordPress Manually?

You can also choose to create a child theme manually. You would just need a bit of HTML and CSS knowledge, and you should be good to go.

Here is a step by step procedure on how you can create a child theme manually.

  • Access the Control Panel and click on File Manager
  • Go to WordPress Installation Directory > wp-content> themes
  • Create a folder and give it a name. Example: twenty-20-child
  • Next, create a style.css file
  • Open the file and write the following line of code:
	/*
	Theme Name: Twenty-20
	Template: twenty-20
	*/
  • Next create a functions.php file and write the below code in it. This will import the style of your parent theme:
 <?php
	add_action(‘wp_enqueue_scripts’, ‘enqueue_child_theme_styles’, PHP_INT_MAX);
	function enqueue_child_theme_styles() {
	wp_enqueue-style(‘parent-style’, get_template_directory_uri(),’/style.css’);
	}
	?>
  • Next, zip this folder and upload it on your WordPress website by visiting Appearance > Themes > Add New
  • Activate the theme

This way, you can easily create a child theme, and update your parent theme without losing any changes and breaking any functionality.

How do Child Themes Work?

Child themes are the separate entities, but they rely on parent themes for most of their functioning. If you have a child theme, WordPress will crosscheck the child theme and see if there is any additional functionality. If no such functionality exist, it will continue to use parent theme.

However, if you plan to change or modify even a slightest part of the theme, you should always use child themes for two pretty good reasons:

1. Organization

When you customize your existing theme or add code to it, you are basically adding code to a codebase of various lines. This makes it difficult to track all the changes. This is when child theme comes to your rescue and makes the things easier.

2. Updates

If you choose to modify a theme without using a child theme, it is likely that – you will not opt for updating themes in future, or, you will update and lose all the recently made changes.

This is when child theme helps you out by allowing you to update your theme without making you lose important changes.

Wrapping Up

That said, it is evident by now how important role a child theme plays. It takes off extra responsibility from your shoulders and helps you update the parent theme without second thought.

In order to create a child theme, all you need to understand is a bit of HTML and CSS. The above tutorial would have helped you in creating a child theme step by step. However, if this sounds like too much technical work for you, you can also choose to use plugins which is a simple way to create a child theme.

All you would need to do is install and activate the plugin, and it would take care of the rest.

However, if you are stuck anywhere and have any query, do let us know in the comments below.

No comments yet. Be the first to add a comment!

Write a comment

Loading...