If you bought a theme and wanted to make changes of it, you need to create a child theme to keep your changes safe when the theme gets updated.

To create a child theme, open the wordpress directory and navigate wp-content->themes. Create a folder for your child theme. You can name it to whatever you like. In our example since we will be making a child for Divi theme, we will call it Divi-Child.

Shares

Open the child theme folder and create two files, style.css and functions.php. These are the 2 required files for a child theme.

Shares

Next, lets add another files. Lets name them custom-css.css and custom-js.js. These will be the files where we can add our custom css and javascript.

Shares

Now that we are done creating the child theme files, its time to do some coding. In this example i will be using Visual Studio Code as my preferred code editor. Now lets edit the style.css.

Shares

The theme name will be the name of the child theme. You can put whatever you like. The theme URI can be anything. Description can also be anything you like. Author will be your name or anything you want to appear as the theme author. Author URI can be anything. Template will be the Parent theme folder name. In this example since Divi is our parent theme, I put Divi as parent. Tags and version can be anything you like.

Shares

Lastly, open the functions.php and copy the function below.

Shares

Some theme does not require wp_deregister_style( ‘divi-style’ ). We only do this in Divi so we make sure we are printing the correct stylesheet of Divi.

That’s it. Go ahead and upload the child theme into the themes directory of your site and you will see a new theme when you navigate Appearance->Themes of your site.

Shares

PS: You can also put a thumbnail of your theme, make an image and call it screenshot.jpg. Place it in the child theme folder.

Pin It on Pinterest

Shares
Share This