What is Child Theme?
A child theme in WordPress is a theme that is derived from another WordPress theme known as a parent theme. A Child theme is frequently used if you want to make custom changes such as editing the theme, adding some more functionality to an existing WordPress theme without losing all the custom changes that you had made even after the updates.
Earlier there is a risk that the changes you have made will be lost after the updates and if you do not update the theme, there are chances that someone will hack your site.
The WordPress community decided to solve the problem faced by the users after updating the theme by introducing the concept of a child theme.
How to create a child theme from a parent theme?
A child theme is generally consisting of two things:
- The child theme directory
- CSS and functions.php file
Step 1: Create a backup of your current theme using FTP, SSH or your Web Hosts file manager (c panel) in case of emergency.
Step 2: Downloading the current theme using FileZilla (this will also backup your current settings)
I have taken backup using FileZilla:
- Download FileZilla by from here
- After installation, open FileZilla. Then go File -> Site Manager or press ctrl + s.
- After this, a new dialog box opens and in this click on New Site.
- Enter your host name (i.e., domain name) and port. A port is 21 for FTP and 22 for SFTP. After that, select your protocol that is provided by your web hosting and encryption in case of FTP is same as shown in the image given below. Logon type is “ask for password” and then enter your user name and password that is provided by your web hosting and click on connect.
- Now FileZilla is connected to your domain. After that, download the file.
Step 3: Making style.css file for our child theme.
- Extract the download file using WinRar. Open the folder and then go to html -> wp-content -> themes. Here you find all the themes that are currently installed on your WordPress. Now make a new folder and give any name to it. (In this case, I am making a child theme of twentyseventeen, so I am giving the name “twentyseventeen-childtheme”.)
- After that, we have to create child theme’s spreadsheet, open the folder that you created for the child theme and make a new CSS file named as style.css It should contain the following information:
Theme Name: twenty seventeen child theme
Theme URI: http://yourdomain.com/
Description: Child theme of twenty seventeen
Author: Your Name
Author URI: http://yourdomain.com/
Above is an example of twenty seventeen theme Powered by WordPress, we have imported the other settings from the parent theme i.e, original twenty seventeen theme using the @import url.The
The Template line corresponds to the directory name of the parent theme. The parent theme name in our example is the twentyseventeen, so the Template will be twentyseventeen. If you are working with a different theme, so change accordingly.
Step 4: Making some changes to the child theme.
- Now we make some changes to our theme to make it look different from the parent theme, the reason behind making the child theme. For this, I am changing my footer details from Powered by WordPress to such as copyright © 2017 your domain.
- My parent theme footer looks like this:
- For making some change in the footer section we have to create a new PHP file named as footer.php into the theme folder and copy the following information in that file:
<?php/** * The template for displaying the footer * * Contains the closing of the #content div and all content after. * * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials * * @package WordPress * @subpackage Twenty_Seventeen * @since 1.0 * @version 1.0 */
</div><!– #content –>
<footer id=”colophon” class=”site-footer” role=”contentinfo”> <div class=”wrap”>”<center><h3>Copyright © 2017 <a href=””>Your Domain</a>. All rights reserved.</h3></center>”</div><!– .wrap –> </footer><!– #colophon –> </div><!– .site-content-contain –></div><!– #page –><?php wp_footer(); ?>
- After making changes save the file, now the folder contains following file:
Step 5: Uploading the theme to the WordPress
- Make a zip file of the theme folder using WinRAR and go to your WordPress Dashboard, then go to Appearance -> themes, click on Add New and then click on upload theme. Choose the theme and click on install now.
- When theme installed successfully you get this message:
You can also make functions.php file for your child theme for changing the functionality of the theme
This materials was given by Akdoogle.com/ only for instructive/instructional functions .Administrator is not responsible for its content material.Comply with us through web-based networking media/download utility to maintain awake up to now with our product refreshes!