Refer a business & get paid up to $200. What are you waiting for, let's get started! >

A WordPress Child Theme – Why You Need it and How to Create One

A WordPress Child Theme – Why You Need it and How to Create One

Imagine finally coming across the WordPress theme you really like, only to discover that it has limited built-in options that make it impossible for you to make the changes you want. Of course, if you have coding experience, you can make the changes directly to the theme’s code, but you will lose all of your modifications when the theme updates to a newer version. There are other options, like a custom CSS plugin, but this only allows you to make basic changes to the design and layout of your website, you can’t work on the template itself or other core files. So, how can you customize a WordPress theme to suit your unique preferences if you cannot use a custom CSS or the theme options? Easy, you create a child theme for the original theme!

What is a Child Theme?

Very few WordPress users go all out to fully customize their WordPress theme, and even those who do, rarely use a Child Theme. In most cases, it is because they don’t know what a Child Theme is and how important it is to their customization. On the other hand, those who know what it is assume that creating one is too difficult.

George of www.domains4less.co.nz - a web hosting service provider - defines a Child Theme as “essentially a theme that makes use of the functionality inherited from another theme usually called a Parent Theme. A Child Theme allows you to change, add or remove from the functionality of the Parent Theme without the fear of losing your customizations during theme update”

What this means, in essence, is that instead of making changes to the original theme, you can easily create a Child Theme from the original theme and then make changes that override the Parent Theme’s functionalities; it is actually the safest way to make changes to a theme. For instance, if you make a mistake in your modifications, you can easily revert back to the original theme without losing your website. Also, as we’ve seen, an update to the Parent Theme will not cause you to lose any of your changes. The Child Theme actually inherits every aspect of its functionality from the Parent Theme which is already installed on your WordPress website.  Every update made to the Parent Theme is inherited by the Child Theme, however the modifications you made will remain, unlike if you modify the original theme itself.

A Child Theme does not only make customizations easier, it also adds to the overall security of your website and serves as a great learning tool for designers that are not accustomed to coding. You are at liberty to tweak your website as much as you want, and if anything goes wrong, you simply go back to your original design by activating the Parent Theme.

What is a Child Theme

How to create a Child Theme

You can create a Child Theme yourself  or make use of an already-made Child Theme plugin. To create one yourself, you will need the following:

  • An FTP client – for transferring files to your web server. There are a few good ones on the internet you can try out such as FileZilla and CuteFTP.
  • FTP login details for your website.
  • A plain text editor such as notepad for PC or TextEdit for Mac.

Step by step guide to making a Child Theme

In this example, we will be using the preloaded WordPress twenty-seventeen theme. This method will work fine for any other theme, free or purchased.

  • Step 1:

Login to your WordPress root using your preferred FTP program and navigate to /wp-content/themes/. You will create a new folder in this location. Give the folder any name you like, but don’t use any spaces or punctuation.

  • Step 2:

Inside this new folder, create a new file and name it style.css. This is where a good part of your modifications will be done.

  • Step 3:

Using your preferred text editor, open the style sheet file (style.css) in your Parent Theme folder. This is the theme you are going to be customizing. Copy the header code in the Parent Theme stylesheet. (It typically starts with /* and ends with */).

  • Step 4:

Now open the style.css file in your Child Theme folder using a text editor. It should be empty at this point. Paste the code you copied from the parent theme stylesheet into this file. You need to edit certain information in the code to reflect the identity of your Child Theme. For instance, you need to change the theme name. Add a new line under “Author URL” called “Template” and include the name of the Parent Theme you are inheriting from so that WordPress will know the theme to customize.

  • Step 5:

At the end of the Child Theme header (where you have */), add a line of code to import the Parent Theme’s style. It should look like this:

@import url(“../twentyseventeen/style.css”);

Put the name of your Parent Theme in place of twenty-seventeen. If you fail to do this, your child theme will look dull. It is below this line that every other customization will be added.

  • Step 6:

Log in to your WordPress dashboard, navigate to appearance and activate your Child Theme.

  • Step 7:

Now you can customize the Child Theme without worrying about losing your work or website. However, remember to add any custom CSS below the import line in your Child Theme stylesheet.

You will need to copy any template you plan on customizing over from the Parent Theme folder to the Child Theme folder. If you can’t figure out the templates that need customizing, the WordPress template hierarchy may be able to help you out. Do not copy all the PHP files from the Parent Theme folder, only copy those PHP files you plan to modify.

Using plugin

If you don’t feel comfortable moving around the background of your website, then you should consider using a plugin to create your Child Theme. It works fine too and involves no file transfer or coding.

This is a safe and simple method strongly recommended for beginners.

There are several Child Theme plugins on the internet you can try out. Most of them involve the simple process of downloading, installing, and activating the plugin in your WordPress installation. Others may require that you add one or two lines of code.

Conclusion

Congratulations, you have now successfully created a Child Theme for your website. Now you need to test your website across multiple devices to make sure that everything is working properly. If your website fails, simply log back in using your FTP program and rename the Child Theme folder so that your website will revert back to the original template. You can then check to see if you made a mistake anywhere.

Related Articles

About the Author

Che

Che

Hello, I am Che and I have been designing websites for over 12 years now for small businesses across the globe.

I have a real passion for helping small businesses achieve their online goals. I am a big believer in educating my clients so that they have the necessary skills to perform daily tasks on their web sites and online. All clients are provided with one on one training, and our training videos can be viewed on our website.

I started CheDesigns back in 2012 when I moved to Australia from the UK with my small but awesome family.

I believe that every small business, just like YOURS, should be able to have an online presence at a reasonable price, but with a website that will help generate leads and sales. I have spent enormous hours developing the perfect website platform that clients can easily use but that also helps gain them success online.

Even after CheDesigns builds your website we will still be here to answer any ongoing questions you might have.

Email: This email address is being protected from spambots. You need JavaScript enabled to view it. Website: https://chedesigns.com.au

Blogs from our Superhero’s

GET IN TOUCH

08 6812 0261

GET A FREE QUOTE