Create a Child Theme

One should never customise a theme directly. If you do you could lose all your changes should the parent theme be updated. To overcome this problem in WordPress you simply create a child theme which you can then customise to your heart’s content.

If you are using Stix or any other STARTER theme you do not need to create a child, you change the name of the starter theme and do your customisation in the newly named starter theme.

Creating a child is extremely simple, all you need do is follow these steps:

  • Create a theme directory in your WordPress install
  • Create a style sheet with information about your child.
  • Enqueue the styles of your parent theme

After this you can activate your child theme and your website will look exactly the same as before, but it will be using your child. Please take note that to make this work you need the parent theme installed in your WordPress install as well as your new child.

Firstly you need to create a new directory in your /wp-content/themes/ directory. Give the directory the same name as the child you want to create.

You now need to add two new files to the newly created directory, style.css and functions.php.

style.css

You need to paste the following into your new style.css:

/*
 Theme Name:   Twenty Nineteen Child
 Theme URI:    http://yourwebsite.com/twentynineteen-child/
 Description:  My first child theme, based on Twenty Nineteen
 Author:       Your name
 Author URI:   Your URI
 Template:     twentynineteen
 Version:      1.0.0
 Tags:         one-column, two-columns, right-sidebar, accessibility-ready, custom-background, custom-header, custom-menu, custom-logo, editor-style, featured-images, footer-widgets, full-width-template, rtl-language-support, sticky-post, theme-options, threaded-comments, translation-ready
 Text Domain:  twenty-nineteen-child
*/

Please replace all references to Twenty Nineteen with the name of the parent theme you are using and replace the references to Twenty Nineteen Child with the name of your child.

functions.php

You need to paste the following into the newly created functions.php:

<?php
add_action( 'wp_enqueue_scripts', 'your_theme_enqueue_styles' );
function your_theme_enqueue_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );

}
?>

Please replace the your_theme_ bits with the name of the new child.

That’s it, that is all you need do. Enjoy your new child theme.

Arnold.

Start the Conversation

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


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.