Thursday, January 20, 2022
HomeWeb DevelopmentWordpress CourseHow to create a Child Theme for WordPress (Step by Step)

How to create a Child Theme for WordPress (Step by Step)

What is Child Theme?

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
download filezilla.jpg
  • After installation, open FileZilla. Then go File -> Site Manager or press ctrl + s.
FileZilla-open
FileZilla-open
  • 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”.)
open wordpress folder
  • 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/
Template: twentyseventeen
Version: 1.0.0
*/
@import url(“../twentyseventeen/style.css”);

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 &copy;  2017 <a href=””>Your Domain</a>. All rights reserved.</h3></center>”</div><!– .wrap –> </footer><!– #colophon –> </div><!– .site-content-contain –></div><!– #page –><?php wp_footer(); ?>
</body></html>

  • 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.
WordPress Child,How to make wordpress theme,wordpress child theme,child theme,wordpress theme.
  • 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!

MOHD AIYUB KHAN
Hello friends, I am AIYUB KHAN and I am Technical Auther & Co Founder of Akdoogle And if I talk about education, I am a Post Graduate Engineer. I love learning and researching new technology and telling and teaching others about them. If you continue to support me in this way, then I will continue to bring such new things to you. Such as Internet, Computer, Technology, Development, Seo Etc ... #We Are Experts!
RELATED ARTICLES

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -

Most Popular

Tech News

Latest Videos

Recent Comments

error: Content is protected !!