WordPress Security is important now more than ever. To help with vulnerabilities, it is extremely important to update your WordPress Theme on a month to month basis. One problem many inexperienced designers run into is at the time they update a theme, most of their work will be overwritten and they will have to re-upload their files to maintain their changes. Child themes will solve this issue and creating one is a very simple task. Developing a child theme will allow you to customize your theme of choice without disrupting the core foundation of the theme. This will allow updates or additions to occur without overwriting your file and page changes and styling.
How do you create a Child theme for WordPress?
Before adding a child theme you will need to activate your preferred theme. Once activated, create a folder on your computer and name it as a child theme to your primary theme. Create a style.css file within this folder and add the following:
Theme Name: Your Child Theme’s Name
Description: This is the Child Theme of Primary Theme’s Name
Author: Primary Theme’s Author
Author URI: Primary Theme’s developer link
Template: Primary Theme’s Name
Once this folder is created and the stylesheet is setup you will need to activate this child theme. Once activated, your WordPress Website will run off of both your child theme and primary themes core. Within the stylesheet you can either add new styles or make changes to existing styles located under the primary themes stylesheet. To force override simply add “!important;” after each class call. This will ensure the style will be used oppose to the primary themes stylesheet.
For example, say you have an h1 style located on your Primary Style sheet:
In order to change the styling, open up your child theme’s CSS file and simply add and change the style:
Please note the “!important” comment after the style calls. This will designate importance level over the primary themes stylesheet.
You can also use a child theme for raw plugin or template php files. For example, say you wish to remove the pagination to your single.php theme file. If you copy and paste this file into your child theme folder, your theme will run off of this file instead of the primary themes file. Any adjustments made here will override the main themes template file.
As you will see, making modifications within your child theme will allow you to make adjustments to files and still allow you to update your theme. This is a great way to keep things organized and maintain your primary themes core functions.