What is a child theme and when to use it

//What is a child theme and when to use it

What is a child theme and when to use it

I will be very honest and straight in this post. When I started monkeying with WordPress code and customizing WordPress themes I had no idea why I needed a child theme? I am not saying that I had no Idea about What is a child theme and when to use it. Of course I came across this information that you should use Child Themes when you decide to take matters in your own hands and start changing things around.

The problem with this definition is “It does not define what do we mean by taking matters in my own hands”. So do I need the child theme or not ?

I will try to answer this question in a simple way so you can determine if you need one or not.

The first thing is to look at the modification you want to make ? If your modification to the Theme involves php code, go for a child theme! If your customization is just some CSS, most modern themes will provide a place holder for “Custom CSS”. If you are using a theme that does not provide an option for Custom CSS, you can always install a plugin that will. If you are looking for one, you can find one at https://wordpress.org/plugins/simple-custom-css/

If you are not sure on whether you need one or not, going with a child theme is always a safe bet and will not hurt you in any way. I recommend that you set it up even if you dont use it. Of course you don’t need to do this if you think you will never ever require a customization but in case you do it will be helpful.

So what happens if you modify theme files directly?

Again I will confess, I have done this in the past. In my defense, I was only a beginner when it came to WordPress Customization. Because I hated the child theme and getting into the discussion about them, I simply choose to make changes to the theme directly and save my changes so I can re-do them when the theme gets updated. Now I really feel bad about that! I should not be waiting for things to break and some panic in my customer. What about my theory of always doing things the right way? I stick to it now and install a child theme before making any code modification.

Where do I get the child theme from?

The WordPress Codex does a fair job of explaining what you need but I do understand that it can be a little overwhelming for a WordPress noob. Most Modern Themes will provide a Child Theme and if your theme does not, reach out to the author for one. That is if you do not know how to create one. It is very simple to create your own and it has been documented so many times that I do not want to document it. Although I have never used this plugin but it claims that it can create child themes just by a few clicks. Check it out at https://wordpress.org/plugins/one-click-child-theme/

What are they used for?

A lot of modern themes provides hooks (Action/filters) where you can modify the theme by simply defining php code in the child theme and not necessarily overriding the php provided by the theme. So you can use your child theme for that. Additionally if you have to override the php files you need to have a child theme as well. Another important one is the page template. If you decide yo create your own page template, you should define it in the child theme. Any modification in functions.php should also be defined in a child theme. You can define your own shortcodes and code snippets for plugin customization and really take the matter in your own hands. All the best and happy coding!

By |2017-09-12T14:12:28+00:00September 12th, 2017|Blog|0 Comments