A child theme is a WordPress theme that inherits the functionality, features, and style of the parent theme. You can customize the child theme without making any changes to the parent theme. When you update a WordPress theme, you lose all of your customizations. But when you use a child theme, your customizations are stored in the child theme and won’t be lost when you update the parent.
Creating the child theme is an easy process. You can create and activate the child theme in two different ways.
First method:
You can create and activate the child theme manually. To create the child theme manually please follow the below-given steps:
Step 1: Go to your /wp-content/themes/ and create a folder for your new child theme. You may name it anything you’d like. For example, If you want to create the child theme of Travel Log, name it travel-log-child.
Step 2: Create a stylesheet file within the child theme folder. This must be named style.css
. Copy and paste the following code into the file you’ve just created:
/** * Theme Name: Travel Log Child * Author: WEN Solutions * Template: travel-log * Text Domain: travel-log-child * Description: Travel Log is a simple and clean Travel WordPress Theme. */
The two necessary items in the code above are the lines starting with “Theme Name"
and “Template
.” The theme name tells WordPress what the name of your theme is, and the template tells WordPress which theme it should consider as the parent theme.
Step 3: Finally, you have to make sure to enqueue the parent and child style through the functions.php file of the child theme.
Code to enqueue style of parent and child theme is given below:
<?php /** *Recommended way to include parent theme styles. *(Please see http://codex.wordpress.org/Child_Themes#How_to_Create_a_Child_Theme) */ add_action( 'wp_enqueue_scripts', 'travel_log_child_style' ); function travel_log_child_style() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); wp_enqueue_style( 'child-style',get_stylesheet_directory_uri() . '/style.css',array('parent-style')); }
Second method :
Since the first method is a little bit time consuming, you can directly activate the child using the plugin given below:
For more details, please watch given below YouTube video:
Also, if you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Facebook, Instagram, and Twitter.
Further, if you have any queries, please submit them to our Contact page.