Are you looking for a method how to to create child theme and why we create it? You will create your child theme in  2 steps easily.

Why should we create a Child theme?

Because if we want to customize theme and Plugin to achieve our goal with custom code without changing the original theme files. If we edit the original theme files and whenever theme update the custom code will be removed  and site will be crashed. That’s why we create a child theme.

Method 1: Creating a Child Theme Using Code

First you need to open Your wordpress theme files like a go to  /wp-content/themes/ in your WordPress installation folder and create a new folder for your child theme. You can name this folder anything you want. For this tutorial, we will be naming it GCWtheme.

  1. Create First files  as function .php using notepad, sublime text tool
  2. Add screenshot png image for child theme
  3. Create Style.css files and save it. ( we add CSS Code for theme UI)

Start by opening a text editor like Notepad. Then you need to paste the following code into the empty document.

  1. Theme Name:   WPB Child Theme
  2. Theme URI:    https://www.gcloudworker.com/
  3. Description:  A Twenty Twenty-One child theme
  4. Author:      gcloudworker
  5. Author URI:   https://www.gcloudworker.com
  6. Template:     twentytwentyone
  7. Version:      1.0.0
  8. Text Domain:  twentytwentyonechild

This code contains information about the child theme, so feel free to change it to meet your needs. Now save this file as style.css in the child theme folder you just created. This is your child theme’s main stylesheet.

The next thing you need to do is create a second file that will import, or enqueue, the stylesheets from the parent theme. To do that, create a new document in your text editor and copy in the following code.

  1. /* enqueue scripts and style from parent theme */
  2.    
  3. function twentytwentyone_styles() {
  4.     wp_enqueue_style( 'child-style', get_stylesheet_uri(),
  5.     array( 'twenty-twenty-one-style' ), wp_get_theme()->get('Version') );
  6. }
  7. add_action( 'wp_enqueue_scripts', 'twentytwentyone_styles');

This code will work when you use Twenty Twenty-One as the parent theme.

If You are using Avada theme Then use this Code on below to add in Function.php files and activate it in theme appearance

  1. wp_enqueue_style( ‘child-style’, get_stylesheet_directory_uri() . ‘/style.css’, [] );
    }
    add_action( ‘wp_enqueue_scripts’, ‘theme_enqueue_styles’, 20 );
  2. function avada_lang_setup() {
    $lang = get_stylesheet_directory() . ‘/languages’;
    load_child_theme_textdomain( ‘Avada’, $lang );
    }
    add_action( ‘after_setup_theme’, ‘avada_lang_setup’ );
    //————>>>>>>custom code below<<<<<————-//
    if(is_front_page() && is_home() ){
    echo ““;
    }