WP – Opinion (sort of) – Do you need a child theme?

WP – Opinion (sort of) – Do you need a child theme?

Do you need a child theme?

 

 

Yes, always.

 

 

 

 

 

 

 

 

 

 

 

 

 

Oh, more? OK… well.. This should be enough to convince you to use a child theme…

“Child themes provide an extra layer of security that is valuable in building and customizing a website.”

(note: by security, I don’t mean against hackers, I mean against errors and bugs and customizability)

 

But I’ve noticed that it’s not always the case.. so.. Before we get into this, I just want to mention that, for the record, I think I shouldn’t be bothering myself about this, because… you should have already be using a child theme.

But.. I’ve seen that it’s not standard practice, and also that some people who are very adamant about not using a child theme.

Which I think is ridiculous.

This blog is aimed at the beginner and intermediate front-end developer, but I do try to make sure it also addresses questions that newbies would have, which means I shouldn’t assume anything.. so here we are.

OK. Here’s a hypothetical situation:

If someone offered a pretty comprehensive deal for insurance on your car, and it was free, and all you had to do was sign the contract… would you? Or would you just say “oh, I’m not planning on getting into any accidents, so I’m ok?”

I think it’s pretty stupid and crazy to not sign up for free insurance.

What if that insurance covered modifications? What if the insurance covered all the oil changes and even regular maintenance?

“Nah, I’ll be driving safely, and I won’t open the hood, so I won’t need ANY insurance.”

Come on, how is it a good idea to NOT get FREE insurance?

 

That’s what a child theme is.

It’s insurance on your website.

It keeps everything on a different layer, so you’re much safer when things go haywire.

Let me explain.

A child theme is a smaller version of a theme that piggybacks on the “parent theme” and offers the same experience. BUT anything you do to the child theme while it’s activated, everything is retained inside the child theme. If you switch themes (even between child themes) then you can switch between those settings easily.

** side note:
This has allowed many popular (builder) themes to provide a framework, and have lots of companies offer child themes as finished products. They’re usually called “premium” child themes and quite a few companies are heavily invested in this business model. You can find child themes for Genesis, Divi, Storefront, etc. This is slightly different from offering “demo content” which is usually a json file being loaded to get all the settings and content running to minimize customizations.

Also when I mean child themes, I usually do not mean “premium” child themes. I mean the basic child theme, without any particular customizations pre-installed.

 

So, what constitutes a child theme?

In the past, it was made possible with just one styles.css file in a folder, and adding CSS to that file to override the parent theme. Simpler times.

Now, it’s been taken further, and done more comprehensively. So now, the stylesheet is enqueued (loaded) with a dependency on the parent theme (meaning, if the parent theme doesn’t load, then the child theme doesn’t load).

What’s great about child themes is that you can include a lot of extra php files and override the parent theme’s files. This is great for sitewide customizations.

Nobody is debating that. Not even the misguided souls that I will have to address below. No one is debating the fact that child themes are needed when the customizations are extensive.

Now for the frustrating part.

Here’s what a lot of (irresponsible and misinformed) “WordPress developers” say with quite a bit of (misguided) assertion:
“You only need a child theme if you’re going to make customizations, and if it’s just for a bit of CSS, then you don’t need it.”

I’ve seen that comment uttered/typed quite often.

To be fair:
Yes, it is possible to update the theme without a child theme and keep the extra custom CSS that was added in the “custom CSS fields” that many themes offer on their theme options page. This is because the CSS in that field is saved in the database, and is enqueued by the theme on the front end. So a theme update won’t disturb the extra CSS.

So we need to talk about this irresponsible argument. (I say irresponsible because if a car salesman tells a buyer that free comprehensive insurance is unneeded.. that’s irresponsible.)

Now I know that some people are just stubborn to no end, and will not ever give up on their stupid opinions. Stupid people vehemently arguing stupid opinions against blatant facts are a problem, and I can’t do anything about those people. I can’t change the world, but if I can get some people to start using child themes as standard practice, then.. I’ve at least done my part. So, in case I help anyone wanting to learn, and change, then.. please read on.

It’s been established that there are many advantages of using a child theme, right?

We’re past that now, right?

OK.

So, let’s look at other aspects, and to be fair, we can talk about websites that require only “a bit of CSS.”

ONE. Future proofing.

There can be more edits in the future, and a case where a child theme is needed may arise. Migrating to a child theme from a parent means that all the theme settings will have to be inputted again (or as a json file depending on the theme) which is a pain. This could have been avoided if a child theme was used.

Oh, you’re SURE there will be no edits worth having a child theme?

Alright then… let’s go on..

TWO. It can be very tricky for anyone who inherits the site.

There is no way to know what edits have been made, meaning updating anything comes with a huge liability. And the person who inherits the website will be very unhappy.

That was about professional courtesy, which some people might not care about. Especially if it’s your own website, right? Then this one is really important.

MOST IMPORTANTLY

THREE. The child theme provides a layer of customizations that can be packaged real easily.

Let me explain.

The theme that is activated has its own set of customizations that are saved in the database.
Something like:
“Theme A – white header, logo1, blue text, CSS snippet 1” will be saved in the database.

If you‘re experimenting with some ideas, and then you’re suddenly not sure if that’s the way to go, then you can easily deactivate (child) theme A, and start a new (child) theme named B.

That will save “Theme B – red header, logo2, green text, CSS snippet 2” in the database. (This includes the CSS in the theme options, but not the builder module settings)

You can switch back to child theme A with a couple of mouse clicks, and you get all your theme settings back. Everything that’s been saved will come back, including the theme options in the backend, and the front end theme customizer, and all the CSS that’s been entered via those panels.

There you have it. A few advantages of having a child theme even if all you’re doing is just a couple of edits.

Conclusion

YES child theme -> a bunch of advantages, and NO disadvantages
NO child theme -> NO advantages, and some possible disavantages

I’m sure you can make your own decision now. Right?

 

So PLEASE. Use a child theme.

 

If you need a child theme CLICK ME to use this plugin (child theme configurator) and set one up.

or

Get a free Divi child theme here

Oh, and one more thing. If you’re a designer/developer, then you can add the screenshot.png file and brand the child theme, and even name it so it looks custom.

Photo by Amy Velazquez on Unsplash

Leave a Reply to PK Cancel reply

Your email address will not be published. Required fields are marked *

  1. Hi PK, really informative post. question, what if i’m already using a childtheme from elsewhere? I read it’s technically possible to make a grandchild theme, but i think it just leads to too much confusion. The people who made the childtheme occasionally update it, so i’m hesitant to make changes to that child theme incase their updates overwrite what i’ve done (which has happened before).
    What do you advise?

New tutorials

Why no ads?

Hi, I'm PK, and I maintain and publish content on this site for two reasons.

  1. To give back to the community. I learned so much from people's tutorials and StackOverflow that I wanted to contribute and help others.

  2. To provide a more structured learning experience. People struggle to find the course that guides them from start to finish, based off of real life experience, and my courses provide that.

The only "ads" I have here are for my own courses, and maybe an affiliate link, but that's it. They fund the website resources and provide more motivation for me to produce better content.

Any bit of interest helps. Even sharing with your friends, suggesting my courses to your developer or designer, or subscribing to my YT channel, or joining our Discord. Thanks and I'll see you around!

There's a newsletter!

Sign up to the newsletter for the occasional updates on courses, products, tutorials, and sales.