If you’ve been researching WordPress child themes and still find yourself confused, this article is 100% for you. We’ll completely dissect a WordPress child theme essentials and teach you everything you need to know:
- What is a WordPress child theme,
- What’s the difference between a WordPress theme and a child theme,
- Why use a WordPress child theme,
- How to create a child theme in WordPress, and
- WordPress child theme FAQ.
We also included a few bonus tips, based on our experience and the mistakes we’ve seen new WordPress users tend to make.
Let’s dive right in!
What is a WordPress Child Theme
Despite the name, a WordPress child theme is not a mysterious or a complex concept. At its core, a child theme is a simple WordPress theme that inherits all its functionality from the main (aka parent) theme.
A WordPress child theme typically includes the following files, adhering to the WordPress theme structure guidelines:
- style.css: this file is required, and includes the header info which appears in the WordPress dashboard (Appearance > Themes). This information usually displays theme name, theme URL, author info, etc. This file does not contain any styling data, but is necessary for any theme, including the child theme, to function.
- functions.php: this file contains one essential code that should never be deleted. This code tells the child theme to pull all functionality data from the main (parent) theme.
- screenshot.png: this is the image displayed in the WordPress dashboard (Appearance > Themes), a thumbnail used to quickly recognize or describe the theme. The image size is 1200px by 900px.
- ReadMe.txt: this file is optional, and usually contains brief info about the theme.
What’s the Difference between a WordPress Theme and a Child Theme
The key difference between a WordPress theme and a WordPress child theme is their contents and functionality:
- WordPress theme: a full and complete theme. Contains all the codes and functionality necessary to run a website. It provides design and layout features, as well other additional features like various header formats or blog post styles. A WordPress theme can function on its own and is entirely independent.
- WordPress child theme: a simplified theme, that only contains code to inherit functionality and options from its parent theme. A WordPress child theme is dependent, and can’t function without its parent theme. The parent theme must be installed at all times, even though it remains inactive.
Basically, any theme that is not specifically a child theme is a main (parent) theme.
When it comes to customizing your website, a WordPress child theme is essential if you do not want to lose your changes when the parent theme is updated. And no, we’re not talking about the styling and other changes added via the WordPress Customizer (Appearance > Customize).
Why Use a WordPress Child Theme
One of the most common mistakes new or inexperienced WordPress users make is editing theme files directly.
While editing a WordPress theme directly seems like an easy and quick way to achieve certain things, this approach will lead to further problems, especially when the time comes to update the theme.
When a WordPress theme is updated, the original theme files are being replaced with new ones. It’s not hard to guess that all changes you made to the main theme files will be lost.
By using a child theme, you can safely make all customizations without the risk of losing them during the theme update process.
Main Use Cases for a WordPress Child Theme
There’s an entire universe of things you can achieve with a child theme, but the main reasons to use a child theme are:
- Override main (parent) theme or plugin codes: modify default behavior without altering the parent theme or plugin files.
- Add new custom features: create new functionality, like custom shortcodes or dynamic elements.
- Override main (parent) theme or plugin templates: some themes (such as OceanWP) and plugins (such as WooCommerce) contain php files that can be used as templates. As such, you can copy those files into the child theme to edit and override design, functionality or more. This enables you to apply customizations without affecting the parent theme or the plugin in question, as well as keeping the changes after the theme or plugin update.
- Create new templates: add your own page or other templates (php).
Besides the main WordPress child theme use cases, you can also white-label the child theme it to impress your clients.
White-Labeling a WordPress Child Theme
White-labeling is a fun way to customize your child theme, and make it appear as you’ve created a theme from scratch. You can:
- Change the child theme’s folder name;
- Replace the theme screenshot image with your own branding;
- Modify the theme’s style.css file header info, and display yourself as the author, change the theme’s name, and more.
Keep in mind, white-labeling doesn’t make the theme “your own” in its true sense – it just changes the theme’s appearance and information displayed in the WordPress backend.
How to Create a Child Theme in WordPress
Most theme developers offer ready-to-use child themes. You can download those .zip files from their official websites, and install and activate just as a regular WordPress theme via Appearance > Themes > Add New Theme.
After that, simply use the Upload Theme option, Choose File (must be a .zip file), and then click the Install Now button.
Using official child themes is the best, fastest and simplest way.
Using OceanWP? You can install and activate the child theme with a single click and no hassle. Follow this guidance on how to install and activate the OceanWP child theme on your website.
If you’re unsure whether or not an official child theme exists, you can always consult your theme developer support.
In case an official child theme is unavailable, you can create a child theme:
- using a WordPress plugin: such as the Child Theme Configurator, WP Child Theme Generator, Generate Child Theme, or any other plugin of your choice.
- manually: you can create a WordPress child theme from scratch following the official guidance (medium to advanced development skills required).
If you decide to create a child theme manually, there are certain things you absolutely need to avoid.
Things to Avoid when Creating a Child Theme
There are 2 main things you should avoid at all cost when creating a WordPress child theme manually:
- Creating a child theme by copying the full parent theme: unless you plan to maintain all functionality and in full from now on and forever, this mistake can cost you missing out on important security, feature upgrades and/or other important or essential updates related to the parent theme. Child themes created in this way don’t receive any updates from their parent theme.
- Copying parent theme’s entire functions.php file into the child theme: this mistake will lead to fatal errors because of duplicate function names.
Now that we’ve covered all child theme essentials, it’s time to move on to the child theme FAQ.
WordPress Child Theme: FAQ
Q1: Should I Use a Child Theme?
A1: If you need to customize a theme in a way that requires code alterations of the main (parent) theme files, be it codes or templates, you should use a child theme.
In this way, your custom modifications will remain intact after the theme update.
Q2: When Should I Install a Child Theme?
A2: The best time to install a child theme is at the very beginning; or, before making a mistake, such as editing the parent theme files.
But, the truth is that you can install a child theme at any point of your website’s development.
Be advised, if you install a child theme after you made significant changes to the parent theme settings (Customizer), and you would like to keep those changes, you will need to transfer the Customizer settings to the child theme.
Q3: How Do I Install a Child Theme?
A3: You can install a WordPress child theme just as any other theme by using:
- WordPress dashboard: upload the child theme’s .zip file via Appearance > Themes > Add New Theme > Upload Theme.
- (s)FTP: you can use an FTP agent (such as FileZilla, WinSCP, Cyberduck or Transmit) to upload the child theme’s folder directly into your website’s directory
wp-content/themes
folder. - Hosting File Manager: through your hosting account, you can use the File Manager to upload the child theme’s folder directly into your website’s directory
wp-content/themes
folder.
If you’re using the OceanWP theme, you can install a child theme directly from your website, via OceanWP > OceanWP Panel > Home, section Download, and use the OceanWP Child Theme feature.
Q4: Should I Activate the Parent or the Child Theme?
A4: If you made modifications to the child theme, in a form of custom codes or file templates, and you need those modifications applied on your website, then you should activate the child theme.
However, whether you should use a child or a parent theme really depends on your personal preference and website requirements.
Q5: How Do I Update the Child Theme?
A5: Child themes don’t get updates directly. When the parent theme is updated, the child theme receives those updates as well, automatically. However, all modifications made through the child theme will remain intact.
You just need to ensure that any custom codes or templates are compatible with the latest version of the parent theme and/or plugins.
Q6: Does a Child Theme Make the Website Run Slower?
A6: A child theme on its own doesn’t have any impact on the website’s speed.
But, if you add poorly written codes to the child theme, that can definitely cause your website to run slower. Always ensure your custom code is optimized.
On a side note, if you’re looking to boost your WordPress website on all levels and without any codes, check out Site Booster.
Q7: Where Should I Add Custom CSS Codes in the Child Theme?
A7: CSS codes are usually added via theme’s style.css file. However, when using a child theme, in order to override parent theme or any plugin theme styling successfully, medium to advanced CSS knowledge is required, because there are specific rules to follow.
On the other hand, classic WordPress theme have an option called Additional CSS (in OceanWP this option is called Custom CSS / JS, because we have expanded the default functionality), located in the theme’s Customizer (Appearance > Customize).
Per WordPress hierarchy, all custom CSS codes added via the Customizer have priority over a theme’s (including child themes) or plugin’s default CSS styling. This means that your custom CSS codes are more likely to function, assuming they’re correct.
Q8: Can a Child Theme Cause Issues and Break the Website?
A8: By default, a child theme on its own can’t cause absolutely any issues, neither cause your website to break. However, if you add bad or incorrect codes to the child theme, or if you don’t maintain templates added in the child theme, that can potentially lead to issues that would result in fatal errors or a broken website.
But that, our friends, is not the child theme’s fault. Likewise, any codes / templates added in the child theme can be modified or removed in order to address the issue.
Q9: When I Activate the Child Theme, Should I Remove the Parent Theme?
A9: The parent theme must be installed on your website at all times, alongside its child theme, even though it remains inactive.
If you remove the parent theme, the child theme will not function.
Final Thoughts
Everything surrounding WordPress child themes seems daunting at first, but in reality, they’re really powerful tools that enable you to customize your website safely and efficiently.
Whether you want to modify a theme’s default functionality, add new features or create custom templates, a child theme allows you to do so without losing any of the hard work during the update process.
By understanding the purpose and best practices of a child theme, you can enhance your WordPress development skills and ensure a smooth website-building experience.
Have any other questions about WordPress child themes we left unanswered? Drop us a comment!