How to create a WordPress child theme

Creating a child theme for WordPress is pretty simple to do, and allows you to add customised styles and pages to your WordPress blog without hacking around with the actual theme itself. By doing this it means you can upgrade the parent theme without losing any customisations you’ve spent hours building, and also if you change to a new theme you can port all of your customisations over!

To create a child theme follow the steps below (you will need FTP access to your WordPress server).

1. Log in to the ftp root and navigate to the wp-content/themes folder
2. Create a folder to store your child theme files (e.g. for the www.furniturerepairmanchester.co.uk site, I used the “Shell-Lite” theme, and called my child theme folder “shell-child-theme”)
3. Create a css file in your child theme folder called style.css, and add the following text:

/*
Theme Name: shell-child-theme /*this should be the folder you’ve just created*/
Theme URI: http: //example.com /*this is optional – I don’t use this*/
Description: Child theme for the Shell-Lite theme /*this is optional*/
Author: Your Name /*this is optional*/
Author URI: http://www.yoursite.com /*this is also optional*/
Template: shell-lite /*this should be the folder of your parent theme*/
Version:1.0 /*this is optional*/
*/@import url(“../shell-lite/style.css”); /*this imports the main stylesheet from your parent theme into your css file (usually called style.css)*/

…you can now put your custom styles here and override the styles from your parent theme

4. Now go into your WordPress Admin panel (usually found at www.yoursite.com/wp-admin) and navigate to Appearance > Themes. You should see your newly created child theme in there, so click ‘Activate’.

That’s it! You can now edit and customise anything within your child-theme folder (like adding a new front-page, or changing the layout of your blog pages) without making changes to the parent theme!

Posted in Front-end, Web development, Wordpress Tagged with: , ,

About Maff

Maff Rigby

I'm a certified .Net, Umbraco and AngularJS freelance developer with over 15 years experience in the IT industry. As well as writing code I love to teach; I run a number of workshops and 1-1 coaching sessions on Angular JS and Umbraco, and share what I know and learn here!

I’m social (ish)

Connect with me on LinkedIn, follow me on Twitter, or fail to find me on Facebook.