How to Create a WordPress Child Theme

by emuslearner
0 comment

WordPress is highly recommended Child Theme for any modification of a parent theme. You can update your parent theme without destroying the modification or the customization which is made with Child Theme. Let’s create a WordPress child theme

1. Create a folder
First, You’ll need to create a folder in site_root/wp-content/themes/parent_theme_name-child. Let’s say your parent theme is Storefront so you’ll create folder name storefront-child

2. Create style.css
Now create a style.css file in your child theme folder storefront-child/style.css and write the code and change Template : PARENT THEME NAME with your theme name.

/*
Template: Storefront
Theme Name: Storefront Child
Theme URL: emuslearner.com
Description: A child theme of Stronefront theme
Author: Emuslearner
Author URL: emuslearner.com
Version: 1.0.0
Text Domain: storefront
*/

3. Create functions.php
Finally, you’ll need to enqueue parent and the child theme stylesheet. Create a functions.php file inside the child theme folder and write the code.

<?php
add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );

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

?>
Storefront parent and the child theme

Copy and paste the screenshot.png to see the preview in your child theme too.

0 comment

More Posts in this topic

Leave a Reply

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

%d bloggers like this: