In its bare bones, a Child theme is more like a copy of your current theme where you can try all sort of customizations dauntlessly and see your results live. If at any stage you falter, you don't have to worry about your website going kaput as you have the parent theme to fall safely back on.
So, a Child theme gives you the wherewithal to make changes to your theme at will, without tinkering around with the code of your website. This way, it comes a safer and more assured proposition for you to update your site whenever the updates are available.
How to Create a Child Theme
So, how hard it is to create a Child theme? Not much, rather, it proves to be a fairly simple exercise if there is a sense of structure to your approach. It is a matter of creating a folder and a file and you are good to go.
Ever heard of Filezilla? Well, it is a must-have tool for webmasters who wish to have a non-fussy way to edit files and folders on their website. It helps us with FRP and that goes a long way in handing you over with amazing customization capabilities.
Log into your website through Filezilla
Once you are there, you need to look for “/wp-content/themes/”. This is actually your theme directory which contains several folders pertaining to your website's theme. Now, in this directory, you need to create a new folder which can be given a name of your choice. It is recommended that you use the name of your original theme and append “child” to the name to make it more identifiable.
Next Stop: Create Style.css File
Creating the style.css file is not as complicated an exercise as you may assume. That said, it has to be created with care since this is the only file your child theme is likely to contain.
Theme Name: My Theme Child
Theme URI: http://wordpress.org/themes/mytheme
Description: My Child Theme
Author: XYZ
Author URI: http://example.com
Template: mytheme
Version: 1.0.0
*/
@import url("../mytheme/style.css");
@import url("../mytheme/style.css");
The names above can be modified as per your theme, but keep the rest of the lines or code intact.
Activate the Child Theme
Now, we move from Filezilla to our Wordpress dashboard. Log in to it and go to Appearance>Themes. Locate your child theme's name in the list of themes and hit the “Activate” button.
Once the child theme is activated, it will signal Wordpress to import CSS from the original theme. Now that the CSS is contained in the new file, it will be prioritized by Wordpress over the already existing CSS. If you are looking for any alterations to your theme's design, there won't be any since you have not made any changes, you have simply reproduced your parent theme to create a child theme.
Making Some Customizations to the Child Theme
So, whether you wish to make some changes to the font or alter the layout, doing so in your child theme's CSS file would suffice. You will have to do so below the @import line. Whatever changes you make in the Child theme will override the existing features of the parent file.
@import url("../mytheme/style.css");
.et-movie-ticket{ color: #5bbc26; font-weight: 250;}
.et-movie-ticket{ color: #5bbc26; font-weight: 250;}
The Functions.php File Can Be Edited For New Features
When adding a greater number of custom functions is on the agenda, you can very well create an altogether new functions.php file in the folder of your child theme. Because of the way you have configured your site, the new functions will load on priority.
Now, this new functions.php file will b e starting with a php opening tag, and it will end with a php closing tag. You can add your functions in between. The required code will be added between the tags
// This is where you add the php code
?>
?>
Thereby, the Child theme proves to be extremely resourceful in upgrading your website with the latest features, as and when the need to do so arises. If you happen to be one of the folks who are still skeptical about updating their Wordpress themes with the fear of losing their current settings, I reckon you re-read the post. A child theme gives you a bonafide excuse to dump your fears and let your Wordpress website be updated with the most avant-garde features.
No comments
Post a Comment