Child Theme:
A child theme is like a modified version of a main theme for a website, which can be used to make changes without affecting the original theme. It is safe to use child theme and also you can upgrade to orginal theme without losing your customized code in your child theme.
Child Theme Sample Code:
- Create Led Folder inside wp-content (exact path where parent theme is available)
- Create two file style.css and functions.php file inside child theme folder
- Pase below code for style.css and functions.php
Add below code in style.css
/*
Theme Name:Smartlog Child
Theme URI: https://themecanary.com/themes/smartlog
Author: Theme canary
Author URI: https://themecanary.com
Description: Smartlog Child is the child theme of Smartlog Theme.
Version: 1.0
Text Domain: Smartlog-child
Template: Smartlog
License: GNU General Public License version 3.0
License URI: http://www.gnu.org/licenses/gpl-3.0.html
Tags: threaded-comments, right-sidebar, custom-background
All files, unless otherwise stated, are released under the GNU General Public License
version 3.0 (http://www.gnu.org/licenses/gpl-3.0.html)
==================================================
*/
Add below code in functions.php
<?php
add_action( 'wp_enqueue_scripts', 'smartlog_enqueue_styles' );
function smartlog_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
?>
Need more info about child theme? Click Here