Creating a child theme in WordPress

Need to Create an new folder in the themes folder as

/themes/ THEMENAME- CHILD

here are the two files that be added for creating child theme

style.css

/*! 
Theme Name: Highend Child  // Theme name
Theme URI: https://www.hb-themes.com/themes/highend/  // URI
Author: HB-Themes
Author URI: https://hb-themes.com
Description: Premium Responsive Multi-Purpose Theme Child Theme
Version: 1.0.0
Template: HighendWP  // Theme Folder Name
License: GNU General Public License version 3.0
License URI: http://www.gnu.org/licenses/gpl-3.0.html
Details URI: https://hb-themes.com/changelog/highend/
Text Domain: hbthemes
Domain Path: /languages
*/

Add functions.php file to overide

<?php
function highendwp_child_enqueue_styles() {
    $parenthandle = 'highend-style';
    $theme = wp_get_theme();
    wp_enqueue_style( $parenthandle, get_template_directory_uri() . '/style.css', 
        array(), // if the parent theme code has a dependency, copy it to here
        $theme->parent()->get('Version')
    );
    wp_enqueue_style( 'custom-style', get_stylesheet_uri(),
        array( $parenthandle ),
        $theme->get('Version') // this only works if you have Version in the style header
    );
}
add_action('wp_enqueue_scripts', 'highendwp_child_enqueue_styles');

?>

Leave a comment

Your email address will not be published. Required fields are marked *