Okay
  Print

How to create child theme based on our theme for WordPress?

Follow this steps to create Child Theme:

  1. Create new folder with name like themename-child, for example if you have Antonette theme you should name your folder antonette-child.
  2. Copy img/ and inc/plugins/ folders with all files inside to your child theme folder from our theme folder.
  3. If you have theme released before 25 February 2016: Create cache/ folder inside child theme folder and check that server can write to this directory (set write permissions). If you have theme released after 25 February 2016: Create css/ and js/ folders inside child theme folder and check that server can write to this directories (set write permissions).
  4. Create style.css file inside child theme folder with this content (change themename to your parent theme folder name everywhere):
    /* 
    Theme Name: Child of themename
    Theme URI:
    Description: Child theme based on themename
    Author: Your Name
    Version: 1.0
    Template: themename
    */
        
  5. 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-parent-style', get_template_directory_uri() . '/style.css', array('bootstrap'));
        wp_enqueue_style( 'themename-child-style', get_stylesheet_directory_uri() . '/style.css', array('bootstrap'));
    } 
    ?>
  6. Upload your child theme folder in /wp-content/themes/ and activate your child theme from Appearance > Themes.
  7. Go to Theme Control Panel and Save settings to write new cache files to child theme cache folder.
  8. Now you can add your CSS styles to child theme style.css file and your PHP customizations to functions.php file.

Troubleshooting

If you have problems after migrating from localhost to real server check this.