In this post we will learn how to create WordPress Child Theme. WordPress is a ultimate PHP based CMS, very popular, very user friendly and best for blogging and website creation. It is also very popular because it is Free and Open source cross platform CMS, themes and plugins are free avaiable in WordPress.org site. Even you can also get premium themes and plugins from various vendors. WordPress is now like a ocean of opportunities for many developers, companies and its users.
Today, in this post I am sharing about how to create a child theme in wordpress.
What is WordPress Child Theme
In WordPress, child theme is basically a theme derived from its parent or original theme. Rather then directly changing the code of parent/original theme , we create child theme. In child theme we do changes and modify the theme as per our need.
Technically speaking, Child theme basically inherit all the functionality from its parent theme. Modify the changes in child theme and overide the functionality of parent theme.
Advantage of WordPress Child Theme
The main advantages of WordPress Child Theme are –
- We do not have to modify or changes in parent theme. If any functinality need to be changed, it can be done from child theme
- Themes developer updates the code regulalry. When the parent theme get updated ,your code in child theme will not be affected and no changes in design you will see on your WordPress blog/website.
- Best way to learn about WordPress theme development.
- Fast way to develop your own WordPress theme.
How to create WordPress Child Theme
I expect you have already installed WordPress on your system.
Brief about child theme we are going to create –
WordPress Child Theme Name : mytheme
Parent Theme : Twenty Fourteen
To create a WordPress Child Theme, follow the given below steps:
Step 1: For tutorial purpose, we are creating Child Theme from Twenty Fourteen
Create a new directory inside
wp-content/themes/ inside WordPress installed directory on your web server. We have created a folder called mychildtheme inside
wp-content/themes/. The mychildtheme folder name is similar to our child theme name “mychildtheme”.
Inside mychildtheme folder, create a
style.css file and paste the below given content and save. You can change the value as per your Child theme(Given below is just for example)
Theme Name: mychildtheme
Theme URI: http://www.blogmynotes.com
Description: Mytheme is a child theme of Twenty Fourteen
Author URI: http://www.blogmynotes.com
Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
Text Domain: mychildtheme
/* =Theme customization starts here
Step 2: Now log into WordPress admin dashboard from web browser i.e http://yoursitename.local/wp-admin Click on Appearance >> Themes
In Themes section, a new theme called “mychildtheme” is available. Here you will also notice there is no screenshot for ‘mychildtheme’. It will be appear as shown in given below figure
Hover your mouse over mychildtheme and click on ‘Theme Details’ See below given figure, ‘Theme Details’ will be appear like this.
Now activate this child theme by clicking on “Activate” button .
Now open your website/blog URL address in Web browser. The new child theme design is implemented now.
After mychildtheme get activated, you will see ‘Customize’ button. Click on ‘Customize’ and explore it. Do the changes as per your requirement.
How to add screenshot to WordPress Child Theme
In above section, you have learned about creating Child Theme. You may have noticed, there was no screeshot in Theme section at WordPress Admin Dashboard to ‘mychildtheme’
To add a screenshot, you have to create screenshot yourself. Usually I create the screenshot of size 320×250 and also use awesome online tool i.e Pixlr
Give the name of screenshot as screenshot.png.It should be in png format. Copy or FTP this screenshot.png file to mychildtheme directory (wp-content/themes/mychildtheme)
Now refresh Theme section of WordPress Admin dashboard. You will get the screenshot displayed on mychildtheme i.e the child theme you created.
See below given reference, the screenshot which I created for mychildtheme.
Now you child theme is ready. You can edit and modify the child theme as per your need. You can also add your own functions.php , header.php,footer.php etc. files as per designing requirement. You can edit the style.css or add new css file as well.
Enjoy WordPress theme development.
Reference: WordPress Theme Development