TutorialLab
create WordPress child theme
Home » Web Development » Wordpress Tutorials » How to Create WordPress Child Theme Tutorial

How to Create WordPress Child Theme Tutorial

Create WordPress Child Theme

To create WordPress child theme’s it provide WordPress developers and site managers a better way to modify or customize the code of a theme. The obvious thing we do normally, download a theme and then change the style of theme or do other type of correction.

While this works fine, it’s actually really bad practice because if later on down the line you update the theme, all your changes (and hard work) will be lost! So you’re left with the options of either never making modifications, or making changes and then never applying an update, or having to re-do all your changes every time you update.

A child theme is essentially an empty theme that inherits anything it doesn’t have from the “parent-theme”. Anything you add to the child theme therefore overrides the equivalent in the parent theme. That sounds complicated, so here’s an example scenario:

  • You start out with a Parent Theme you want to modify, let’s say it’s Twenty-fifteen.
  • This typically contains Style.css (the theme’s CSS), function.php (a place for php functions) and a bunch of .php files that are templates for pages or parts of pages.
  • Let’s say you want to modify the standard page template, which is the file called page.php in the parent theme
  • So you create WordPress child theme and activate the basic child theme.
  • Now you copy the file you want to modify from the Parent folder to the Child folder
  • Modify the copy in the child theme
  • Now the child version of the file is the one which WordPress uses, so when you update your WordPress parent theme than there will be no effect on the child theme, so *hopefully* updating won’t break anything and you site remain same with the same updated theme.

Now clearly this isn’t perfect.

But when parent theme update massively than it can effect your child theme too but you don’t have to worry that will be only minor changes to the child theme,but normally WordPress theme doesn’t do massive updates.

But it is a lot safer and more reliable than just changing the parent theme directly.

 How to create WordPress Child Theme?

A WordPress child theme really just needs:

  1. A Folder in “wp-content/themes/”, name the folder whatever your Child theme is to be called eg “wp-content/themes/yournewtheme/”
  2. In that folder you need to create a style.css file, add this code to the top of the style.css file and customize the options according to your need and according to your parent theme CSS:
3. In the same folder, make a functions.php file and add this code to the empty file:

4. Once created don’t forget to activate it!

if you require any assistance or you have created any type of child theme for website than please post the url in the comment section.it will make us happy to help someone and we see the output (result).

hassan

A Freelancer web developer, graphic designer and own this blog to spread knowledge.My hobby is computer problem's solving and i love to help other in this field.

Follow us

Don't be shy, get in touch. We love meeting interesting people and making new friends.