How to Create WordPress Child Theme Step by Step Tutorial

Share on

Do you want to create WordPress child theme step by step? WordPress let you create child theme that has the ability to inherit all the characteristics of the parent theme.

In this article, we’ll show you how to create WordPress child theme step by step in two different ways:

  • Creating a WordPress child theme manually
  • Creating a WordPress child theme using the plugin

What is a WordPress Child Theme?

WordPress Child Theme is a WordPress theme that acquires all the functionality and features from the parent theme. It’s easy to change the child theme without affecting the parent theme however if you make any changes in parent theme it will automatically make changes in the child theme itself.

Requirements to create a WordPress Child Theme:

The basic knowledge of HTML/CSS helps to make changes on your own concept. It will be better if you have some basic PHP knowledge that surely helps too.

Creating a WordPress Child Theme Manually

Before creating a child theme ensures the parent theme need to present on the Appearance >> Themes pages.

Step 1: Navigate the “wp-content/themes/” in the WordPress installation directory and create a folder name Eg: newsportal-child.

Step 2: Next, Open the text available text editor on your device and paste this code:

/*
Theme Name: News Portal Child
Theme URI: https://mysterythemes.com/wp-themes/news-portal-child/
Description: News Portal Child Theme
Author: Mystery Themes
Author URI: https://mysterythemes.com/
Template: News Portal
Version: 1.0
*/

Once pasted, save the file named as style.css in the just created “newsportal-child” folder.

Step 3: Create a function.php file on the same folder and paste this code:

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

Step 4: Once you pasted the code, zip the folder and Go to Appearance >> Themes >> Add New to Upload the file.

Step 5: When the theme is successfully installed, Click on the Activate and this is how it looks like:

Activate WordPress child theme

If you don’t want to create manually then you can create WordPress child theme using the plugin.

Creating a WordPress Child Theme using Plugin

Child Theme Configurator – WordPress plugin WordPress.org-min

Step 1: Download the Child Theme Configurator plugin.

Step 2: Log in to the WordPress admin area of your site.

Step 3: Go to Plugins >> Add New.

Step 4: Click on Upload Plugin, then Click the Activate button to activate the plugin on your site.

Step 5: Now go to Tools > Child Themes. The “Child Theme Configurator” plugin main screen will appear.

Step 6: Select the parent theme and fill all the options and Click on the Create New Child Theme.

Step 7: You will get a notice on the top of the page by saying the Child theme has been generated successfully. Click on the Preview your child theme link.

Step 8: Finally, Click on the Activate & Publish button.

In this way, you can easily create Child WordPress Theme using Plugin. For more in details, you can see the Child Theme Configurator installation.

Customize your WordPress Child Theme

Once you’ve created the Child theme, you can start to customize the WordPress child theme. Through this article, we will show you how to create and customize WordPress child theme:

  • How to customize the design in Child Theme?
  • How to edit the templates file of single.php in WordPress Child Theme?

How to customize the design in Child Theme?

To customize the design, you need to edit the style.css file of Child theme that is located on the child theme folder. Example: Add the below code in Child theme’s style.css if you want to change the color and font:


a{
color: #DAE3FA; 
font: medium; 
text-decoration: none;
}

By doing this, the Child theme’s style.css rule for “a” overrides the style.css of parent theme. Similarly, if you want to change the layout of posts and pages, you can enable to overrides the default layout by creating your own layout in the template files.

How to edit the templates file of single.php in WordPress Child Theme?

You can easily edit the templates file such as single.php in Child theme by following steps:

  • Simply copy the parent theme file from the folder.
  • Paste it to the corresponding location in the child theme.
  • Open the file in the available text editor and edit it.

In this way, you can easily overwrite any template of parent theme from the Child theme.

Conclusion

Hence, this is how we can easily build WordPress child theme step by step. If you like this article, give us your feedback and don’t forget to subscribe to us and also follow us on Facebook and Twitter.

You might also like to read our other informative articles:

Share on

One thought on “How to Create WordPress Child Theme Step by Step Tutorial

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.