How To Create A Child Theme In Wordpress

Create child theme wordpress


Why, how to create a child theme in WordPress? Answer in this article.

When creating a blog, you always have an idea of ​​design that you want to give it. We download a free WordPress theme or premium and begins to adapt it to give it a personal touch and add some extra features.

A recurring error when you start a WordPress blog is to directly edit files on its theme, which could be problematic for the future.

Good practice would we create a child file of the theme which was chosen for the design of his WordPress blog.

WHY CREATE A CHILD THEME WORDPRESS?


Most premium themes, and some free WordPress themes, offer regular updates. These are available in your administration panel board such as for default WordPress themes.

These updates have several purposes:

  • Closing security gaps
  • Fix bugs
  • Add Features

If you have modified your theme without a child theme, if you make this update, all your changes will be undone ... in this case I would like to have taken notes of the changes, otherwise , good luck.

With a child theme, you will be able to update your WordPress themes without the risk of losing your changes. Indeed, the changes recorded in your child theme will overwrite the settings of your parent theme.

Also, create a theme allows to see more clearly in your customization work, I'll get there.

HOW TO CREATE A CHILD THEME IN WORDPRESS?


First, do not panic, creating your child theme will take you less than two minutes.

We will describe the steps one by one on the assumption that you have already installed the parent theme to your server.

Step 1: Create your child theme folder

On your computer, simply create a new folder naming it as follows:

Name Theme From Parent - Children

Step 2: Create a style.css

In this new folder, create a style.css. To do this, simply create a new text file (right click, then new document Text) and rename it to style.css (so that the file is well rename style.css and must not style.css.txt that extensions are not hidden on your pc).
In the style.css file, add the following code:
/ *
Theme Name: "Child Theme name"
Description: Child theme theme "Theme name"
Author: Your name
Template: "Theme Name"
* /

import url ("../ Name of Parent theme / style.css");
Of course take time to edit this file by replacing especially "The name of the parent theme."

Your child theme is ready, as for the other themes whose parent topic, place the folder / wp-content / themes /. You can now activate.

Step 3: Change your theme

Your child theme now in place, it is in this that all changes must be made. For the CSS file, it will therefore add the changes to the newly created file style.css.

As I indicated to you earlier this article, working with a child theme allows to see more clearly changes its theme style.css do here with the changes you want to make.

Think any time to review this file to gain even more clarity. For this, your comment must be placed between / * and * /
/ * This is a comment * /

To edit a page type of your chart, it will copy the file to your parent in your child page.

It is not clear? If you want to change the code of your header (for example), it will copy the header.php file of your parent theme to your child theme. Thus the files in the child theme override those of the parent theme.

Warning, it is useless to copy all files, only those that you are editing.

Functions.php file

This is particularly in relation to your other theme files. If you want to add a feature to your parent theme, it will not copy the functions.php file in the child theme, but create a new one. This will only include contributions you wish to make.

Functions.php file of your child page will not overwrite that of your parent theme, it will be loaded before the two files being so considered.

If you understand the principle, you will see that there are no great difficulties and this will allow you to control all your changes and take advantage of future updates to your theme.
How To Create A Child Theme In Wordpress How To Create A Child Theme In Wordpress Reviewed by Nicole on April 29, 2015 Rating: 5

No comments:

Powered by Blogger.