• Facebook Icon Link
    • Instagram Icon Link

    How to Make a WordPress Child Theme.


    how to make wordpress child theme

    Tutorial Overview.

    In this tutorial, I will explain what a WordPress theme is and what a WordPress child theme is. We will also determine if and when you would need one. Then I will explain how to create one, how to install it on your WordPress website and how to activate your child theme.

    Quickies.

    What is a WordPress Theme?

    A WordPress theme is a combination of files that define the look and feel of a website. A theme controls things like colors, fonts, page layouts, blog styles etc. In this tutorial, I will refer to this as the parent theme.

    What is a WordPress Child Theme?

    A WordPress child theme is a theme that inherits all of the styles and behavior from a parent theme. It must be paired with a parent theme and cannot function without one. Using a child theme lets you customize your website without editing any of the parent theme files. This allows you to run updates on the parent theme without overwriting your changes.

    When Do I Need to Use a Child Theme?

    If you plan on modifying any files in your parent theme you will need a child theme.

    Why Do I Need to Use a Child Theme?

    If you want to customize the look of your website beyond the default ability of your parent theme, you would have to edit the files in that theme. So what happens when your parent theme releases an update? There is a good chance that you will lose your modifications because the files will be overwritten.

    I am going to be using Divi, by Elegant Themes as my parent theme in this tutorial. It is the best theme I have come across for ease of use for my clients and I highly suggest you check it out if you don’t already have a go-to WordPress theme. If you need to install WordPress check out this tutorial: How to Install WordPress.

    Divi WordPress Theme Banner

    Note: If you are not using the Divi theme, this process will still work. Just substitute your theme name where I reference the Divi theme name.

    Things You Will Need to Make a Child Theme.

    • A text editor like notepad++ or Sublime Text. There are many others available.
    • A way to access your website files or admin access to the website.

    There are 3 Required Parts of a Child Theme.

    • A folder.
    • A file named style.css.
    • A file named functions.php.
    • Optional: A thumbnail image.

    How to Make a WordPress Child Theme.

    If you are not using Divi, substitute your theme name for divi. e.g. twentynineteen-child.

    1. Create a folder named divi-child. (Do this on your desktop and we will load it to your website later)
    2. Create a file named style.css and put it in the divi-child folder.
    3. Open the style.css file in a text editor and copy & paste the following code at the top:
    /*
    Theme Name:     Divi Child
    Description:    Divi Child Theme
    Author:         TwentySixForty
    Author URI:     https://twentysixforty.com
    Template:       Divi
    Version:        1.0.0
    */
    

    There are technically only two pieces of the above code that are necessary:

    • Theme Name.
    • Template – This must match the name of the parent theme which in our case is Divi.
    1. Save the style.css file.
    2. Create a file named functions.php and put it in the divi-child folder.
    3. Open the functions.php file in a text editor and copy & paste the following code at the top:
    <?php
    function divichild_enqueue_scripts() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    }
    add_action( 'wp_enqueue_scripts', 'divichild_enqueue_scripts' );
    
    1. Save the functions.php file.
    2. Optional Theme Image: Create an image that is 880px by 660px.
    3. Save it as screenshot.png and put it in the divi-child folder.

    How to Install a Child Theme in WordPress.

    There are 2 ways to get your child theme into WordPress:

    • Use an FTP client. If you are unsure how to make an FTP connection, check out this tutorial: How to Create an FTP Account.
    • Upload a .zip file directly in WordPress

    How to Install a Child Theme via FTP.

    1. Make an FTP connection to your server.
    2. Find your themes folder by going to wp-content > themes.
    3. Place your divi-child (or whatever you named it) folder into the themes folder.

    How to Install a Child Theme Directly in WordPress.

    1. Compress the divi-child folder into a .zip format.
    2. Login to the admin area of the website.
    3. Go to Appearance > Themes > Add New > Upload Theme.
    4. Upload and activate your divi-child.zip file.

    How to Activate a Child Theme in WordPress.

    Once you have created and uploaded your child theme, you need to activate it.

    1. Login to the admin area of the website.
    2. In the admin menu, click on Appearance.

    appearance wordpress menu

    1. You should see the child theme you just installed.
    2. Hover over the child theme and click on Activate.

    wordpress child theme

     

    Additional Posts.

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    Pin It on Pinterest

    Share This