🎥 How to create a Child theme

Check the video tutorial on Youtube


If you are planning to change the code of your theme then WordPress recommends you protect all of your hard work with a Child Theme. This is important if you plan any modification because it is likely that they will be overwritten when you update the theme. The best method of protection is a child theme in which you can make create copies of a theme’s files and tweak them, without fear of it being overwritten by any future theme updates.

Please note that creating child themes in order to change the theme functionality is intended for the developers only. We do not recommend doing this without reason, as it's customization and it's not covered by our support service - more details here.

Are you using Hestia? Check out how to create a child theme for Hestia.

Are you using Neve? Check out how to create a child theme for Neve.

Instructions:

All you need to do is create one folder, and stylesheet and functions file. And make sure that you have FTP access before you continue reading this documentation. 
Log into your website using your favorite FTP client, such as FileZilla, and navigate to wp-content/themes/ directory. This is the directory where all your themes are living a happy life.
Now, you need to create a new folder for your child theme. You can name it anything. For this example, we will be creating a child theme of Zelle Pro, so we will name it zelle-pro-child.
Once you have created your folder, you need to create a style.css file inside that folder. Your stylesheet will consist some vital information inside it, so paste the following in it using your favorite text editor:   
   /*
   Theme Name: Zelle Pro Child
   Theme URI: https://www.themeisle.com/ 
   Description: This is a custom child theme I have created.
   Author: ThemeIsle
   URI: https://www.themeisle.com/ 
   Template: zerif-pro
   Version: 0.1 
   */
	

Now, we need to load the stylesheet of the parent theme. Create a file named functions.php in the child theme folder, edit it, and paste the following:

<?php
add_action( 'wp_enqueue_scripts', 'child_enqueue_styles',99);
function child_enqueue_styles() {
    $parent_style = 'parent-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 ) );
}
if ( get_stylesheet() !== get_template() ) {
    add_filter( 'pre_update_option_theme_mods_' . get_stylesheet(), function ( $value, $old_value ) {
         update_option( 'theme_mods_' . get_template(), $value );
         return $old_value; // prevent update to child theme mods
    }, 10, 2 );
    add_filter( 'pre_option_theme_mods_' . get_stylesheet(), function ( $default ) {
        return get_option( 'theme_mods_' . get_template(), $default );
    } );
}
	

That's all. Save all changes.

Head back to Appearance > Themes, in your WordPress dashboard, and activate the new Child theme.

==========================================================================

NOTE: If you're creating a child theme for any other theme, then you would need to replace "Template: zerif-pro" above with the folder name of your theme example " Template: neve".

If you already made some changes in your parent theme from Customizer, then they probably won't appear after activating your child theme. So to solve that, you can use  Customizer Export Import plugin.

Having difficulties? Contact us here:  https://themeisle.com/contact/.
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us