1. Home
  2. Docs
  3. Customizing
  4. Creating a Child Theme

Creating a Child Theme

It is recommended to create a child theme as this will allow you to customize your theme with custom page templates or custom code without worrying about not updating anymore. With a child theme you can keep your themes and plugins up-to-date.

Follow these steps to create a child theme from scratch:

  1. Create a new folder on your desktop called ‘my-child-theme’.
  2. Inside this folder you will need to create two files, namely: style.css and functions.php
  3. Add the following code to your style.css and save your file:
    1. /*
       Theme Name:   My Child Theme
       Theme URI:    https://yoohoothemes.com
       Description:  A custom child theme.
       Author:       Yoohoo Themes
       Author URI:   https://yoohoothemes.com
       Template:     parent-folder
       Version:      1.0.0
       License:      GNU General Public License v2 or later
       License URI:  http://www.gnu.org/licenses/gpl-2.0.html
       Text Domain:  my-child-theme
      */
    2. Be sure to adjust the Template: parent-folder to Template: eli.
    3. Take note: the Text Domain value should match that of your child theme’s folder.
  4.  Inside your functions.php add the following code and save your file:
    1. <?php
      add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
      function my_theme_enqueue_styles() {
          wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
      
      }
  5. Once these two files are created, compress (zip) your ‘theme-name-child’ folder and upload this through your WordPress dashboard.

Tip: Taken from the WordPress codex – https://codex.wordpress.org/Child_Themes

 

Tags , ,