How To Create A Child Theme in WordPress

June 30, 2017

A WordPress Theme is a collection of files that produce the graphical interface for a wordpress website. You can find plenty of free or premium themes on internet. A good premium theme providers will aggressively

  • Update their themes with new features and functionality
  • Add more security features or bug Fixes
  • Update any browser compatibility issue
  • Keep up with the latest WordPress enhancements.

Whenever a new version of your WordPress theme is released, WordPress dashboard will notify you to update your theme to the latest version. WordPress experts always recommend you to update yo themes to your theme to latest version.

But when you update your theme, you’ll lose all the tweaks you made to it. How can you update a WordPress Theme without losing customization? WordPress is providing an easy mechanism to solve this issue. It is parent theme child themes combination.

What is a Parent Theme?
A parent theme is a complete theme which includes all of the required WordPress template files. Any theme in your /wp-content/themes/ folder is considered as parent theme.
What is a Child Theme?
A child theme is simply a theme that inherits the functionality and looks of another theme – the parent.

How to Create a Child Theme

A child theme consists of at least one directory with minimum two files (style.css and functions.php) in it. In fact only one file ( style.css) is required in child theme. But functions.php is necessary to enqueue styles correctly. You can create child theme folder with necessary files locally and upload it  using an FTP client. Or Create child theme from Cpanel FileManager.

  1. Step1. Create a child theme folder:

    First, create a new folder in your themes directory, located at wp-content/themes.(See how to create a folder in Cpanel) The directory needs a name. It’s best practice to give a child theme the same name as the parent, but with -child appended to the end. For example, if you were making a child theme of twentyfourteen, then the directory would be named twentyfourteen-child.

  2. Step2. Create a stylesheet: style.css

    Next, you’ll need to create a stylesheet file named style.css, which will contain all of the CSS rules and declarations that control the look of your theme. Your stylesheet must contain the below required header comment at the very top of the file. This tells WordPress basic info about the theme, including the fact that it is a child theme with a particular parent.

  3. Step3. Create a functions.php file

    Your child theme’s functions.php file should start with a php opening tag and end with a php closing tag. In between, you can add your desired php code.

  4. Enqueue the parent and child theme stylesheets

    What if Child theme does not overwrite parent themes style.css
    Some times ever after adding css code to your child theme, you don’t see any changes to the site’s style.

    For this, you need to enqueue it and add the parent stylesheet to the childtheme. The correct method of enqueuing the parent theme stylesheet is to add a wp_enqueue_scripts action and use wp_enqueue_style() in your child theme’s functions.php.

    add_action( ‘wp_enqueue_scripts’, ‘enqueue_parent_theme_style’ );
    function enqueue_parent_theme_style() {
    wp_enqueue_style( ‘parent-style’, get_template_directory_uri().’/style.css’ );