First Let’s take a look at some of the things about wordpress themes.
In WordPress a theme define the layout and design of your website. You can Add a theme by navigating to Appearance >> Themes in your dashboard . (How to install a theme). There are several free and paid WordPress Themes available on internet.
After activating a theme, small Design Changes can be done from the wordPress Customizer. But the options may be limited . You can edit theme files directly to create custom look. It is not a good idea to make direct changes to your WordPress theme files.
Your theme developer will release updates every now and then. These new updates are essential for security and performance improvements. When an update is released, You will see a notification to update your theme in the admin area. From your WordPress Dashboard navigate to Appearance > Themes and click on update now button next to your theme.
When a theme is updated to a new version the entire theme directory is replaced. This means you will loose loose your design and other changes which you have made in your theme.
HOW TO UPDATE A WORDPRESS THEME WITHOUT LOSING CUSTOMIZATION
Fortunately, WordPress provide a feature called child theme to customize your themes safely.
- What is a WordPress Child theme?
- Does this child have a parent?
- Why is it called a Child Theme?
The answer is simple.
A WordPress child theme is just the same as a regular theme that have a ‘parent’ from which they inherit all their functionality. When talking about child themes, we first have to talk about the relationship between parent and child themes.
Parent Vs child theme
To load a page, wordPress will check the child theme first. If none are found, they will take that from the parent theme. Basically a child theme that borrows template files and functionalities from a WordPress parent theme.
How to Create a WordPress Child Theme
So here is a post that states everything you need to know about creating WordPress child themes: /how-to-create-a-child-theme-in-wordpress/
How to Activate a WordPress Child Theme
From your WordPress dashboard go to the Appearance > Themes tab. Inside, Find your child theme. Click on the Activate button.
How to Customize a WordPress child theme
1) Implementing Custom Styles
Edit child theme’s style.css to change the look of your theme. You can add custom style elements and override existing elements.
Edit your style.css using a text editor and FTP client or file manager in cpanel , or WordPress editor (Appearance -> Editor).
Open style.php and add custom styles.
You can also override any existing styles in the parent theme by adding code to the child theme’s style sheet.
For example, in the parent theme stylesheet (style.css), the text color and backgroundcolor is defined in body element(refer fig above). To change that Copy the CSS, Paste it to child theme’s style sheet, edit the background property’s values and save it.
2) Changing the Layout of any page(eg. Posts/ Pages)
In wordpress the layout and design of different parts of your site in determined by template files. For example, the
header.php template set the header design, the
comments.php template set the comments section layout, the
page.php template set the page layout, single.php files sets the single post layout etc. Adding these template files in child theme will override the default parent layout. For example, to change design of single post make a copy of the corresponding template(single.php) from parent theme to child theme and edit file. You can use a text editor with FTP client, or Cpanel file manager to create a copy of this file.
Note: While copying files to child theme, remember to keep the same folder tree structure as the parent. For example, if you want to edit a file named
customizer.php found under ‘inc’ folder, then you need to create a folder of the same name in your child theme’s directory and place the file there.
3) Add/Remove Features in functions.php
To add new features to your theme, add PHP code to your child theme’s functions.php file. To do this, you need to have a bit of php knowledge .