When to Install a WordPress Child Theme
You only need to install a child theme when adding files that do not already exist within the parent theme.
A perfect example of this is outlined in the How to Fully Customize the WordPress Dashboard With Elementor guide, where I had to add files for the new WooCommerce endpoints.
If you just need to do is add some custom code within existing theme files, I’ll give you some better, alternative methods below.
How to Install a WordPress Child Theme
- Make a backup of your website just to have it, even though this is a low-risk implementation.
- Download the Child theme. (Note: The child theme is typically available within the full download from wherever you obtained the theme).
- WordPress Dashboard > Appearance > Themes.
- Click the ‘Add New Theme’ box.
- Click the ‘Upload Theme’ button at the top of the page.
- Click the ‘Choose File’ button and browse to the file you downloaded in Step 1.
- Click the ‘Install Now” button.
- Click on the newly-installed Child Theme box and click ‘Activate’.
Alternatives to Installing a WordPress Child Theme
If you don’t need to add files to the theme, you have other options for adding custom code to your website without the need to edit files directly.
Using a Code Snippet Plugin Like WPCodeBox
WPCodebox is hands down my recommended solution, and you can find out why within the Easily Manage Code Snippets for Your WordPress Website With WPCodeBox guide.
You can also read my post to learn Why I Switched to WPCodeBox for Code Snippet Management.
Custom Code Area of Your Theme
Depending on the theme, there might be an area to add custom code, and while this option is FREE, I do not recommend adding code here for a few reasons.
- It will likely hurt your website’s performance. Why? Unlike WPCodeBox, in which you can tell when and where code should run, any code you add to the custom code area of the theme will load/run in places where it doesn’t need to.
- You risk breaking your website. Unlike WPCodeBox, there is no way to tell if the code you are adding has issues with syntax.
- You’ll miss out on learning a bit about coding and best practices. Unlike WPCodeBox, this area for adding code does not provide an auto-complete feature to assist you with the code that should be entered, nor does it provide you with indicators that you’re not following best practices.
IMPORTANT: Under no circumstances should you be editing parent theme files directly. If someone tells you to edit your functions.php (or any other file) or they edit it on your behalf, you should question their abilities to support you further. Do not edit parent theme files directly!