Creating a child theme

    Posted by on Aug 28, 2015 in Quick Tutorials, Themes, WordPress |

    If you want to make significant changes to your theme, creating a WordPress child theme is key to managing a WordPress site without maintenance headaches.

    Why a child theme?  It creates a safe update resistant place to keep your changes.  It is true:

    • Many current WordPress themes, including one of our favourites – Divi, have some means of adding custom css.
    • There are WordPress plugins for adding custom css to your site that could be used for adding theme css.

    But what about changes to the theme structure, like adding/changing copyright notices and messages in the footer?

    You can’t do those properly with a css change, you need to change the theme files.  If you edit the theme files directly, you will loose the edits when the theme updates.  A child theme solves that problem.

    It’s really easy to make a child theme, it’s only 2 files in a folder.

    1. You need a folder named for your theme, lowercase, words connected by hyphens by convention.
      • Lets use “my-theme” as the folder name for the example, but it can be anything you want.
    2. In that folder you need to create 2 files:
      • A file called “style.css”.
      • A file called “functions.php”
    3. style.css should contain the following header, at the start of the file:
      • Only the Theme Name and the Template are required.
      • The template is the FOLDER name of the parent theme and is case sensitive, in this case it’s set to Divi.
      • Edit or delete the lines in the header as required.

    4. functions.php should contain the following, at the start of the file:
      • The add action and the function load the parent style.css.  If you don’t want the parent style.css, just delete that code.

    That is all you really need to get started, but you can find a lot more detail in the WordPress Codex at: https://codex.wordpress.org/Child_Themes

    For your convenience you can grab the above child theme template all set up to go, you just need to edit the header details.  You can upload a theme .zip file to your site themes, by going to the Themes item in the appearance menu selecting “Add New” and then “Upload Theme”.