Step by Step Guide to build WordPress Child Theme

  • home
  • /
  • WordPress
  • /
  • Step by Step Guide to build WordPress Child Theme

What is a Child Theme?

A WordPress Child Theme is a theme that automatically inherits the features, styles, and templates of a parent theme. Using Child Theme we can modify anything on the current(existing) theme.

Benefits of WordPress Child Theme

  • Now a days all WordPress theme has regular updates from theme developers so if you modified theme before and it is updated, then your modification may be lost. Using Child Theme you will ensure that your modifications are preserved.
  • When a new version of the parent theme arrives, You can safely update it as all your modifications are saved in the child theme.
  • Speed up development time.
  • Easy to Extend.

How to Create a WordPress Child Theme?

In this example, we will be creating a child theme for TwentySixteen Theme of WordPress.

Step 1 :

Create a child theme directory inside “wp-content/themes” and the name of child theme directory will be “twentysixteen-child”.

Step 2 :

Now we have a child theme directory called “twentysixteen-child” inside that we need to create two more files

  1. functions.php
  2. style.css

And if you have a screenshot of your theme then you can upload in this directory as well.

Step 3 :

Now we are going to update style.css file using an editor. Update below code in starting lines of a style.css file.

The most important parts of this file are the “Template:” and “@import” sections.

The “Template” means the directory name of the parent theme. In our case it is twentysixteen and “@import” means we are importing default style of parent theme in a child theme.

If your child theme style.css contain actually CSS code, you will need to enqueue it as well. Setting ‘parent-theme-style’ as a dependency will ensure that the child theme stylesheet loads after it. See Example :

Now your twentysixteen child theme is ready for activation. Log in to your site’s administration panel, and go to Administration Panels > Appearance > Themes. You should see your twentysixteen child theme listed and ready for activation.

Comment(1)

How to Use AJAX in Wordpress Child Theme – Wp Guru
February 16, 2019 At 5:46 am

[…] Make sure you activated Child Theme in your WordPress […]

Leave a Comment

sing in to post your comment or sign-up if you dont have any account.

seventeen − 14 =

This site uses Akismet to reduce spam. Learn how your comment data is processed.