Follow this tutorial to find out if you need to use a child theme for your customizations, and how to use one if you do.
In this article
When You Should Use a Child Theme
If you only need to make style changes to Chosen, you don't need a child theme.
Customizations that purely change the presentation of your site can usually be done with just CSS, such as the following updates:
- Change font sizes
- Change colors
- Remove a site element
You can use a child theme to modify your site with CSS, but it is much easier to use the Custom CSS section in the Customizer instead.
If you're looking to make presentational changes to Chosen like the ones listed above, check out the CSS tutorial: How to Customize Chosen with CSS.
If you need to make a customization that will do any of the following you will need a child theme:
- Reorder site elements
- Add new content/elements
- Change any functionality
If your customization sounds like one of the above, please continue reading.
Why You Should Use a Child Theme
The reason child themes exist is so you can customize a "parent" theme without losing your changes when you update the parent theme.
For example, if you modified the content.php file in Chosen your customization would work fine at first. However, when you update to a newer version of Chosen, you will lose your changes to content.php and there will be no way to restore your customization.
Using a child theme takes a few extra steps, but will allow you to customize your site in a safe and stable way.
How to Use a Child Theme
The first thing you need is an empty Chosen child theme to put your customizations in. You can click the button below to download one:
Now that you have your child theme, the next step is to upload it to your site.
How to Upload Your Child Theme
To upload your child theme:
- Visit the Appearance menu
- Click on the Add New button at the top of the page
- Click on the Upload Theme button at the top of the page
- Click on the Choose File button
- Select the chosen-child.zip file you downloaded
- Click the Install Now button
- Once the page reloads, click the blue Activate link
When you activate your child theme, your settings in the Customizer unfortunately won't carry over from Chosen. However, you can use the Customizer Export/Import plugin to quickly transfer over your settings.
How to Customize with Your Child Theme
Now that the child theme is active, you can make any edits through the Editor menu:
- Visit the Editor menu (Appearance → Editor)
- Make sure the dropdown menu in the top-right corner says "Chosen Child"
- Use the file list on the right side of the screen to navigate the child theme
- Click the Update File button when you're finished editing a file
Please note that mistakes in PHP files can cause errors that result in your site showing a plain white screen. Edit carefully, and be prepared to connect via FTP to correct any mistakes.
How to Customize Your Child Theme Locally
The safest and surest way of updating your child theme is to install WordPress on your computer and edit your child theme there, rather than in the Editor menu.
The benefits of working on a local install are:
- You can make mistakes without affecting your live site
- You can use a nice code editor instead of WordPress' plain editor
- It's faster and easier to experiment
When you're happy with any updates you've made, you can upload the edited files to your site via FTP.