-
Notifications
You must be signed in to change notification settings - Fork 0
Installation
Creating a child theme is a best practice for WordPress theme usage. Themes are updated periodically. If one makes changes to a theme, and then updates the theme to a new version, the changes are lost and will now have to be reapplied. The suggested solution to this problem is a child theme. Any and all changes should be made to the child theme. For a child theme, you need at least three things:
- folder name -child
- Containing function.php
- Containing style.css.
Optionally, you could copy the screenshot from the original theme.
The following is an article on child themes by Nick Schäferhoff: How To Create And Customize A WordPress Child Theme
- Download the WordPress-Child-Theme-Addons by going to the root folder.
- Click the green Code button and select the Download ZIP option.
- Go to the Download folder (can select Show in folder).
- Locate the download and start to extract the content (can right click and select Extract All...).
- In the extract form navigate to an appropriate folder and extract the files.
Note: I built the current child theme while using the Twenty-Twenty parent theme.
Note: I use VS-Code, but I will try to give general instruction.
For this example I am going to configure this to be a child theme for the Twenty Twenty-One theme.
- Launch editor.
- Rename the ThemeName-child folder to the appropriate name (the Twenty Twenty-One theme folder name is twentytwentyone, so rename the folder to twentytwentyone-child).
- Globally search and replace 'Twenty Twenty' with the new theme name ('Twenty Twenty' change to 'Twenty Twenty-One', this will be in two occurrences in Style.css file and one occurrence in function.php file).
- Globally search and replace 'twentytwenty' with the new theme name ('twentytwenty' change to 'twentytwentyone', this will be in one occurrence in Style.css file).
- Optionally, download the screenshot image of the parent theme:
- From the Themes page, click the Theme Details button.
- From the Themes Details form, right click the image and select Save image as ...
- From the Save as form, navigate to the folder in step 2 and click the Save button.
- Right click the saved image and edit the image with your favorite image editor.
- Add the text of Child to the screenshot image and save the changes.
- Optionally, copy the header.php page from the parent theme and add to the child theme. Make any changes to the header.php file in the child theme, such as seasonal feature discussed in the documentation.
- Create a zip file named appropriately (the Twenty Twenty-One theme folder name is twentytwentyone, so name the file twentytwentyone-child.zip).
- Select and copy the folder from step 2 of Configure for a specific child theme.
- Paste the above folder into the zip file.
- Navigate to the Themes page by Appearance => Themes.
- From the Themes page, click the Add New button.
- From the Add Themes page, click the Upload Theme button.
- From the Add Themes page, click the Choose File button. From the Windows Open form select the child theme zip file and click the Open button.
- Returns one to the Add Themes page, click the Install Now button.
- Finally, click the Activate link to activate the theme.