You will need to decide from which parent theme you will build a child theme.

For this tutorial I am using the twentysixteen theme as my patent theme.

Using your favorite text editor use it to create an empty folder with the name twentysixteen-child

If you see carefully the FTP plarform notice that the parent theme name is the same as child theme with the exception of the -child added to the name.

The only reason is for coding best practice.

Now we need to add 2 files to it.

  1. style.css
  2. functions.php

style.css


Add the following code to the style.css file

------------------------------------------------------------------------------------------------------

/*
Theme Name: PARENT NAME Child
Theme URI: http://anything/twentysixteen-child/
Description: PARENT NAME Child Theme
Author: YOUR NAME
Version: 0.1
Template: THE EXACT NAME OF THE PARENT THEME
Text Domain: PARENT NAME-child
*/


-----------------------------------------------------------------------------------------------------

The parent name is the original theme file.


For the twenty sixteen theme you will have the style.css file as shown below;

----------------------------------------------------------------------------------------------

/*
Theme Name: Twenty Sixteen Child
Theme URI: http://punchingbag/twentysixteen-child/
Description: Twenty Sixteen Child Theme
Author: Sheikave Jhurreea
Version: 0.1
Template: twentysixteen
Text Domain: twentysixteen-child
*/


------------------------------------------------------------------------------------------


Now for the function.php file

------------------------------------------------------------------------------------------------------

<?php
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );

touch( get_stylesheet_directory() . '/header.php' );

}
?>

---------------------------------------------------------------------------------------------

The last code ensure that you get a header.php folder in your child theme.

On the next page you will upload the file in your website server.



Join the Discussion
Write something…
Recent messages
LouisaB Premium
Need this training because, I am totally lost.
Anxious to learn more.
Reply
BlSt Premium
I have a dummy question to ask. What is a Child Theme used for?
Reply
CoachGom777 Premium
An innovation of an older theme.
Reply
BobBarr Premium
One use is to allow you to modify the characteristics of a theme and preserve those modifications when a theme update occurs.

Theme updates overwrite all of the files that comprise the theme. If you were to edit your theme's files directly (to change a font color or size for example), those changes would need to be manually edited back into the files every time the theme got an update.

A child theme uses all of the characteristics of its parent theme except for those that you've chosen to override. Since a theme update doesn't overwrite your child theme's files, those overrides are applied to the updated parent theme without your needing to reenter them manually.
Reply
BlSt Premium
Ok, I get it.

Recently I had a theme update in WordPress, AND ALL MY HARD WORK MODIFICATIONS WERE WRITTEN OFF. I had to do all the manual editing again

This is really cool. Thanks a lot for making this very clear.
Reply
sheikave Premium
It happened to me and the new update do not allow direct file modification. That is why i decided to create a train to do it.
Reply
sheikave Premium
A custom mod of the normal theme that you use normally.
Reply
CoachGom777 Premium
Good job for producing this training. I learned two things: First, for creating a child theme; Second, how to really use FTP with WA. I used FTP in the past, but with other hosts. So, thank you so much.
Reply
Top