How to Create Child-Theme

As you know, Wordpress is an awesome product. It has so many themes and plugins. They are very useful. However, there is one problem about theme because if users updated the theme without using something, what they changed would be screwed up. But, Wordpress has feature which is called child-theme and prevent that problem. In this article, I would like to write how to make child-theme.

  1. Make a folder
  2. Create style.css
  3. Create function.php
  4. Activate the child_theme

Make a Folder

First, you need to access the folder(wordpress(your wordpress root) > wp-content > theme) to make a folder. There is one thing, you have to do. It is naming of folder. It must be like the following.

Theme’s name_child

Create style.css

Then, you need to create style.css in theme’s_child folder.

/*
Template:Original
Theme Name:Original_child
*/

In my case, style.css is the following.

/*
Template:dazzling
Theme Name:dazzling_child
*/

Create function.php

Thirdly, creating function.php like above. In addition, you need to code like below.

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

Activate the theme

If you did above steps, you could see the child theme. In my case, dazzling_child. In this step, what you need to do is to click the child theme.

That’s it. After that, when you update an original theme, you don’t need to pay attention to what you added something to php files(By the way, if you want to change other php files, you have to create xxxx.php files) and style.css.

Enjoy Wordpress!!!