Register a one year .XYZ domain for just £1.99!chevron_right

close
Call us 7am - Midnight 01628 200 161My.Tsohostshopping_basket0 Item(s): £0.00
menuMenu

keyboard_backspaceBack to the Blog

What's A WordPress Child Theme?

Posted 27th March, 2014 by Aliysa

What is a child theme?

A child theme is a duplicate of another theme - a parent theme; it inherits the same functionality and appearance. Child themes are used to make custom modifications to a specific theme, without losing these changes when performing a theme upgrade. They allow you to create copies of a themes files and edit them as you please.

Why use a child theme?

If you make changes to a theme (styling etc), you can’t update the theme, as your changes will be overwritten and you’d have to start your customisation again. Ignoring updates is bad practise - it can leave you vulnerable to security flaws which have been fixed in a theme update. By creating and using a child theme you can update the parent theme and these changes, plus your customisation, are reflected in the child theme. A child theme provides you with one separate folder where you can easily track all the changes you’ve made to a theme. It’s an excellent way to start if you’re beginning to learn theme development, and a good approach for more accustomed developers to speed up the development process.

How does a child theme work?

A child theme works by importing the parent themes CSS file within the child themes CSS file. Alone, without any additional code, this makes the child theme identical to the parent theme. But any new CSS information added to the child themes CSS file overwrites the relevant existing CSS information of the parent theme, altering the child theme. It's possible to change more than just the parent themes stylesheet by using a child theme, as documented in the WordPress Codex.

How to create a child theme

1. Choose and install a theme

You should choose a good parent theme that acts as a solid base to build your site with and is well supported. Some themes, named theme frameworks, are created specifically to be used for child themes.

2. Log in to FTP

Log into your website with your FTP client of choice e.g. Filezilla. If you have not created an FTP account before, watch our video tutorial.

3. Create a new folder

In your FTP client, navigate to public_html > wp-content > themes. Create a new folder, typically named ‘[theme name]-child’.

4. Create a new file

Next, add a file - the only file required to create a child theme - named ‘style.css’. Enter the following code into a blank file: Child theme

The real significant variables in the above code are ‘Template’ and ‘@import url’. These variables should both be the directory name of the parent theme. For example, if you’re creating a child theme of the TwentyFourteen theme, the template name would be twentyfourteen, as would the @import url i.e. the part in the example that says parenttheme.

All changes you wish to make to the parent themes stylesheet go beneath the lines of code displayed above.

Save this file, named as style.css, to your child theme’s folder.

5. Activate child theme

Back in the WordPress admin area, go to Appearance > Theme, and the child theme you created should now appear as an option.

What Next?

Now you can start customising your theme! For those unfamiliar with coding, here’s a nice CSS guide for beginners, and our resources for coding blog post lists some fantastic websites for beginners to learn coding interactively.

Categories: WordPress

You may also like:

10 Common WordPress Errors With Quick Fixes
10 Common WordPress Errors With Quick Fixes
The Best WordPress Plugins to Speed Your Site Up
The Best WordPress Plugins to Speed Your Site Up
Fix and Protect Your Hacked WordPress Site
Fix and Protect Your Hacked WordPress Site
Coming Soon - WordPress 4.2!
Coming Soon - WordPress 4.2!
How to Stop Spam Comments in WordPress
How to Stop Spam Comments in WordPress
WordPress Multisite: What You Need to Know

Cookies help us to deliver our services. By using our website, you agree to our use of cookies. Learn More

close