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.
- style.css
- 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.