Recommended way to create wordpress child theme without plugin

Create WordPress child theme in recommended easy way without plugin:

If you are running a website (or) blog powered by WordPress then it necessary to create a child theme for your parent theme. Because, frequently your WordPress theme will be updated which will result in losing theme customization of parent theme. So, this article describes the recommended easy way to create WordPress child theme with out plugin or unwanted stuffs.

Required resources:

  • FTP client – FileZilla (Recommended)
  • Code editor – Notepad++ (Recommended)

Note: Any kind of FTP client and code editors can be used. But above recommended are free and open source materials to use.

Recommended steps to create child theme plugin:

Login into FileZilla FTP client and follow the below mentioned steps one by one so that you won’t be confused. In this example child theme is created for twentyseventeen theme.

Attention: Save all your work on local system desktop which can be finally copied to live website using FTP client.


Step: 1 – Login to FileZilla FTP client:

Navigation in Directory listing: /public_html/wp-content/themes

There you will find the list of themes installed in your WordPress site.


Step: 2 – Create child theme directory:

Now go to your desktop and create a new folder by naming it as Parent theme name-child.

creating child theme folder

In our example its: Desktop\twentyseventeen-child

Hint: Avoid spacing between characters, Use same letter case


Step: 3 – Create style.css:

Create a style.css file using notepad++ in your child theme directory and save it in .css format.

Path: Desktop\twentyseventeen-child\style.css

Then add the following code in style.css using notepad ++ editor and save it with necessary modifications.

Attention: In the above code author name, author URI, etc.. can be changed except Template name which is very important, Because child theme is loaded from parent theme. So the (Template: ) name should be same as the parent theme name. In our case its Template: twentyseventeen if your creating child them for some other theme then it should be Template: Parent theme name

 

/*
Theme Name: Twenty Seventeen Child
Theme URI: http://naadal.com/twenty-seventeen-child/
Description: Twenty Seventeen Child Theme
Author: Naadal
Author URI: http://naadal.com
Template: twentyseventeen
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
Text Domain: twenty-seventeen-child
*/

Code: style.css [1]

adding code to style.css for wordpress child theme creation


Step: 4 – Create function.php:

Similarly, create functions.php file using notepad++ in your child theme directory and save it in .php format. This is done to reduce load time of style sheet by using wp enqueue of styles and scripts.[2] [1]

Path: Desktop\twentyseventeen-child\functions.php

Then add the following code in functions.php using notepad ++ editor and save it without any modifications.

<?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' );}
?>

Code: functions.php [1]       


Step: 5 – Add custom screen shot to child theme (optional):

It will look good if your child has a screen shot in your wordpress dashboard. Add the image that you like in child theme directory and name it as screenshot. This is step is completely optional.

Path: Desktop\twentyseventeen-child\screenshot


Step: 6 – Move from local desktop to live website:

Now, everything is ready to go. Login in to you FileZilla FTP client and copy the child theme file directory from you desktop to /public_html/wp-content/themes


Step: 7 – Activating the child theme:

Go to your wordpress dashboard > Appearance > Themes and activate it. Now you can make any kind of customization and save it. Even if parent theme is updated, child theme customization won’t be affected.


Pros and cons:

ProsCons
  • Recommended way
  • Manual process
  • No need of plugin
  • Might take up to 5 minutes to complete

Reference:

[1] https://codex.wordpress.org/Child_Themes

[2] https://codex.wordpress.org/Plugin_API/Action_Reference/wp_enqueue_scripts

Summary
Recommended way to create wordpress child theme without plugin
Article Name
Recommended way to create wordpress child theme without plugin
Description
Describers the way to create child theme in wordpress to avoid loss of theme customization when it is updated.
Author
Publisher Name
Naadal
Publisher Logo
SHARE
Previous articlePoint spread function

Leave a Reply