Best Practices

What is a WordPress Child Theme?

There is typically only so far you can go with the adjustable attributes of an existing WordPress theme. Eventually, almost all developers find themselves needing at least small tweaks to what was provided. While WordPress is open source and any theme you’ve downloaded is perfectly open to be edited, doing so is not a best practice. Instead, a child theme is the preferred way to adjust a theme.

The advantage of a child theme is that it lives separate from the source files of the parent theme. That means when a new update gets pushed out all of your edits won’t disappear. That could be a very bad thing to have your customizations overwritten every time the theme is updated.

A child theme could be 100% exactly the same as the parent (though, then you wouldn’t need the child). It can have minor adjustments from the parent. Or it could be wildly different just using the parent as a framework. Regardless of how different it is, preserving even small changes will keep you from wasted time.

Basically any file that exists in the child theme will overwrite what is in the parent. That means you may have just one file in your child theme and WordPress will know you want to use all of the other files directly from the parent. The exception is functions.php, which will run in conjunction with the parent, not instead. So if you needed to add just one function that is an easy way to do it.

There is a specific syntax required for the child style.css file. This is what links the child to the parent. You can see more about exactly what that file must contain in the WordPress Developer Help Files.

The next time you find a theme that does ALMOST everything you want if only it had one minor change, you will know to ask around to find someone who can help you develop a child theme for the most robust and technically preferable way to get exactly what you need.