Are you using WordPress and not aware of the WordPress Child Themes?
Are you making changes every time with your theme when it is updated?
Then it’s time to know about the WordPress Child Themes.
I have already written a post on WordPress Theme Frameworks in a different post, so it will be better to check it out first if you have no knowledge about it.
WordPress developed the concept of parent/child themes and integrated it into the core specifically to take care of theme upgrade and customization issues. Theme frameworks like Genesis are based on WordPress’ child theme feature.
Now a child theme is one of the simplest things to grasp on WordPress, so there’s no reason to frown like that. A child theme, as defined by WordPress, is “a theme that inherits the functionality of another theme (aka parent theme).”
Let’s simplify this even more:
Best reason to use WordPress for your website or blog?
Learn the Difference Between WordPress and Blogspot.
What is a Child Theme?
Essentially it’s just a theme based off of another complete Theme. Think of it as a paint job over a car (credit goes to Studiopress for the analogy). The default car, with all its features and interior (as manufactured), is the parent theme. The modifications made over those, without irreparably changing the default car (new paint, alloy wheels, seat warmers… Wow I’m getting off topic) is your child theme.
The minimum requirement for a child theme is a directory (theme folder) named after the parent theme, and consisting of two files – style.css and functions.php. Other files can be created with the same name as parent theme if you want the child theme to override those files in parent theme when processed.
Why Use a Child Theme?
You like your current theme, but you wish it could do a bit…more. You want to jazz it up your way, or maybe add some features/code snippets to it.
That’s when child themes come into play.
While making those same changes right within your original theme files would be your first instinct (cut out the middleman, in this case – child theme, so to speak), those changes will be overwritten anytime the theme is updated.
A child theme, on the other hand, gives you an ‘overlay’ to work with while preserving the integrity of your original Theme.
It’s also a good time to mention that while learning WordPress theme development –child theme customization is an excellent way to start.
How to Create a Child Theme?
- WordPress installation (Duh.)
- Access to FTP
- A text/code editor like Notepad++
You can also use a plugin like One-click Child Theme if you are not able to access your WordPress installation directory.
For those of you who can use the FTP client:
- Go to your WordPress directory
- Access path /wp-content/themes
- Create a new folder (directory) and name it after your parent theme (the one you intend to customize). For instance, if you are creating a child theme for TwentyFifteen, create a new folder called TwentyFifteen-child. This is because WordPress can recognize the child theme and load the changes you have made in the child theme. Do not use any spaces in the name.
- Create two files with your text editor, namely CSS and functions.php. Save them both in the child theme folder.
- Technically, you are done creating a child theme!
How simple was that, right?
Now check out the great tutorial on editing WordPress child themes to do with the theme as you please.
How can you make an Online WordPress Gaming Website?
Essential WordPress Plugins for your WordPress website.
Some Words of Advice (about WordPress Child Themes):
- Make sure to enqueue your parent theme’s stylesheet (CSS) file if you are happy with most of the style but only need to make a few changes. Use wp_enqueue_scripts function in child theme’s functions.php. For parent themes that have more than one stylesheets (and if you want them all) use get_template_directory_uri() function as directed in the tutorial.
- Child themes may cause compatibility issues with parent Themes, although it’s very rare and usually happens after the parent theme is updated with different CSS selectors. Use Firebug to find them and update your child theme accordingly.
- If you have already made changes in your original theme files, you need to download a fresh copy of the Theme, compare the two and put the customized files in a child theme folder instead.
Keep the Codex open in a tab at all times, just to have a reference point.
And if you are having any issue or problem with the WordPress Child Themes, let me know through the comments, and I will be there to help you.
12 Replies to “WordPress Child Themes: What, Why, and How”
i am not a great wordpress developer but i learned myself website building but when ever i want to make any changes to theme,so many say to use child theme.As i am not good at it,i never tried using child theme rather request some freelancer web developer to do the work.
I really didn’t know all of this. thanks for taking the time to share this.
Thanks Alicia. Glad to hear that this post is useful to you.
I sure learned a lot here about Child Themes! It is still a bit confusing to me to do it myself, but at least I can understand the concept. When it comes to technical stuff I’ m all thumbs, but do like to know about it when I ask someone to do it for me.
instead of creating a child theme, it’s better to purchase a seo optimized genesis theme. because we are not developers, we will surely make mistakes on mark scheme and other kinda stuff, So
Great tutorial. It clears many confusions related to child themes.
Thank you for this Awesome post
Thanks Saurabh for saying that.
This is a great tutorial on Child themes. Yeah I love the analogy which you shared that explains the child theme concept. Thanks Tracy
Hi Robin. Maybe Tricky enough can do a post on the WordPress Codex. Take Care and thanks for the post
Thanks ikechi for appreciating my work.
Thanks for that explanation of WordPress Child Themes. I had come across the concept before, but never ventured into creating one. I have to confess it still sounds a bit more complex than I feel like tackling, but at least I have a greater understanding now.
Joy – Blogging After Dark
Thanks Joy. Felt good to hear that it’s useful for you.
I use a child theme and am just about to revamp my blog again so looking for a new theme to try out. I will make sure to be using this though!
Enjoy the journey!