Saturday, 23 November 2019 17:01

how to create wordpress child theme and customize

Written by 
Rate this item
(0 votes)

WordPress has the ability to create child themes so that child theme gets the characteristics of a parent theme. Child theme allows you to use and edit a master theme, save the child theme separately without affecting the parent theme. 

 Every child directory must include its own style.css and functions.php files. More customized files and file types can be added if required. 

1. How you will create child theme? 

a) Create a directory for child theme within the existing wp-content/themes directory, give a name to the directory.

b) Now create a style.css file in this newly created directory. And add following code. 

/*

Theme Name: Twenty Seventeen Child

Theme URL: http://hostinger-tutorials.com

Description: Child Theme - Twenty Seventeen 

Author: John Doe

Author URL: http://hostinger-tutorials.com

Template: twentyseventeen

Version: 1.2.0

Text Domain: twentyseventeen-child

*/ 

Custom CSS codes goes here 

Make sure you put parent theme name in Template field because it tells WordPress what the parent theme is. 

c)  Now  create a blank functions.php file in the child folder, and add any new php functions needed for the child theme.

d) Now you need to activate the child theme, in admin area go appearance -> themes, you see your newly created child theme and click Activate to activate it.

e) Now when you load the site, it will show no styles at all, so you have to load the CSS from parent themes. For this, copy and paste the following codes to the functions.php file:

<?php

add_action( 'wp_enqueue_scripts', 'enqueue_parent_theme_styles' );

function enqueue_parent_theme_styles() {

   wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );

}

?> 

f) Now load your site and you see styles showing up and it's quite look like the parent theme.

g) Now to modify child theme more, you need to add and edit custom.css and other files  according to 

what your goals are. Use google.com to get more help.

 

Hope you liked it, don't forget to like & share it. 

Connect and hire me if you want to learn more - 

https://www.fiverr.com/mitsol , 

https://wordpress.org/plugins/facebook-wall-and-social-integration/

Read 1402 times
Super User

Email This email address is being protected from spambots. You need JavaScript enabled to view it.

Latest discussions

  • No posts to display.