How to create and customize child theme in wordpress ?
or
How to create child theme in wp ? Child theme – wordpress
Here is the way to create a child theme, based on parent or master theme in WordPress.
A child theme allows you to use and modify a master theme, and then save the child theme separately without affecting the parent theme. In case you want to update your parent theme in future then the changes will not effect on your website design.
Before you begin this guide you’ll need the following:
Access to WordPress dashboard area.
Access to file manager or FTP.
To create a new directory, you can either use FTP client or File Manager. Go to existing wp-content/themes directory and add new directory with name of parent theme and add -child to end of that directory. Like if the parent theme name is nstplanet then simply you can add new directory there with name nstplanet-child. Remember not to include any spaces in the file name because they can cause errors.
Like this directory ..
Then add a style.css file and functions.php file inside this folder and copy and paste these things inside the files..
style.css
/*
Theme Name: Nst Planet Child
Theme URI: http://nstplanet.com/planet
Description: Nst Planet Child Theme
Author: Narender Thakur
Author URI: http://nstplanet.com
Template: nstplanet
Version: 1.0.0
Text Domain: nstplanet-child
*/
Note : Please don’t forget to change the name as yourself theme name.
functions.php
<?php
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
After save these two files.. go to dashboard and visit Appearance > Themes. The new theme will be there as per name you given to theme
Just click on Activate to apply this theme.
To add a design overview to theme just copy screenshot.png image from the parent theme to your child theme directory.
Now you can customize the design as per your need through both files.
I hope this help you .. Thanks 🙂
Excellent article, thank you.
Thank you @Erotic 🙂