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 Snapfolio 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:Snapfolio Child
Theme URI: https://themecanary.com/themes/snapfolio
Author: Theme canary
Author URI: https://themecanary.com
Description: Snapfolio Child is the child theme of Snapfolio Theme.
Version: 1.0
Text Domain: snapfolio-child
Template: snapfolio
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, photography
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', 'snapfolio_enqueue_styles' );
function snapfolio_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
?>
Need more info about child theme? Click Here