How to use a child theme in wordpress
Creating a child theme when you are going to edit in code of any
theme’s code can save you a lot of future headache. Child themes allow you to
make changes without affecting the original theme’s code. which makes it easy
to update your parent theme without removing your changes. By creating a child theme, you
can easly update your parents theme without affecting the original theme at
all. Not only does this make updating easier, it also makes sure that you will
never ruin your original theme as you are never actually modifying the files.
You can always turn off your child theme and fall back on the original.
Lets Started
In this example, we will
be creating a child theme for our Demo1 theme. First things first, we need to
create a new folder for your child theme. Naming it something like /deml-child/
is conventional. Within your new theme folder, create a file called style.css
and fill in the information as outlined below. The theme Name, URI, Description
and Author are totally up to you.
/* Theme Name: Demo Child Theme Theme URI: http://www.designerwaves.com/demo/ Description: Demo Child Theme Author: designerwaves Author URI: http://www.Designerwaves.com Template: Demo Version: 1.0.0 */ @import url("../Demo/style.css");
After you have created your child theme folder and style.css file, you can upload and activate your
new child theme. Uploading and activating a child .
Appearances > Themes page in your WordPress Dashboard and activate it. Before
Modifying Your Theme’s CSS
We have now created our Demo
child theme. All content of my theme will be same after importing all relative
files. To modify your theme’s CSS, you can add any changes to your child
theme’s CSS file below the @import line. All new CSS information is added after
the original theme’s CSS is loaded. Because our new CSS is located below the
original’s in the file, all new CSS styles will overwrite the original’s.
Editing file.php of
theme
If you want to make change in any
.php file like function.php, page.php, single.php etc.
Then its
very simple to do, you just create a file with same name which you like to customise
in child theme folder.
For
example if i like to make any change in function.php
Step1 :-
make a new function.php file in demo-child theme folder
Step2
:- Now write your code here
In this
same way you can edit nay other files also like style.css, css/responsive.css
Your path
related to your file were you want to edit will be same like
/wp-content/demotheme/css/custom.css
/wp-content/demo-child/css/custom.css
Its very
simple to edit with child theme and its completely safe to update your
parents theme in future.
If you not
like to do all these things then also not any problem you can use a simple
plugin for it.
|
Additional
Child Theme Resources
1. The One Click Child Theme Plugin –
If you are having difficulty wrapping your head around the creation of the
child theme folder, then this plugin will
create one for you with the click of a button!
|
|
2 comments
Write commentsHello,
ReplyAdmin nice to meet you, Very good review article about wordpress themes and plugins.
By the way, you may heard about thrive themes, thrive content builder, thrive leads plugin, thrive landing page plugin etc. Thrive themes has some good combination of membership and discount to use all marketing tools at a very cheap rate,
You can read my recent published article about thrive themes content builder discount coupon thanks
Read more about thrive themes woocommerce review, thrive themes updated all of their themes including woocommerce features read now thrive themes woocommerce thanks
Reply