How to create a child theme

How to create a child theme

in General Tags: child themehow to

Follow this steps to create Child Theme:

  1. Create new folder with name like themename-child, for example if you have Louvre theme you should name your folder louvre-child.
  2. Create style.css file inside child theme folder with this content (change themename to your parent theme folder name everywhere):
  3. /*
    Theme Name: Child of themename
    Theme URI:
    Description: Child theme based on themename
    Author: Your Name
    Version: 1.0
    Template: themename
    */
    
  4. Create functions.php file inside child theme folder with this content (change themename to your parent theme folder name everywhere):
    <?php
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
    function theme_enqueue_styles() {
        wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/css/bootstrap.css' );
        wp_enqueue_style( 'themename-style', get_template_directory_uri() . '/css/style.css', array('bootstrap'));
        wp_enqueue_style( 'themename-child-style', get_stylesheet_directory_uri() . '/style.css', array('themename-style','bootstrap'));
    } 
    ?>
  5. Upload your child theme folder in /wp-content/themes/ and activate your child theme from Appearance > Themes.
  6. Now you can add your CSS styles to child theme style.css file and your PHP customizations to functions.php file.

1

0

Related Articles

Leave a Reply