NEW HOTEL WORDPRESS THEME

VIEW DEMO
  • Common Articles

  • Child Theme

    The Child Theme is used to ensure that your modifications are preserved and your changes made won’t overwritten by updates of the theme.
    If you need more information please read here the official documentation here or follow these steps to create the child theme.

    1. How to create a Child theme directory

    The first step in creating a child theme is to create the child theme directory folder in wp-content/themes.

     

    It is recommended that the name of your child theme directory is appended with -child and that there are no spaces in your child theme directory name. The child theme name will be for example:

     

    • babykids-child
    • sweetcake-child
    • lovetravel-child
    • weddingcouple-child
    • campingvillage-child

    In the screenshot above we have called our child theme ‘lovetravel-child’, indicating that the parent theme is the Love Travel theme.

    ca-childtheme1

    2. Create the Stylesheet – Style.css

    Now you have to create the child theme’s stylesheet (style.css). The stylesheet must begin with the following the details about the Theme in the form of comments. (stylesheet header)

    Here an example of the Love Travel Child theme style:

    /*
     Theme Name:   Love Travel Child
     Theme URI:    http://www.nicdarkthemes.com
     Description:  Wonderful theme for your travels.
     Author:       Nicdark
     Author URI:   http://www.nicdarkthemes.com
     Template:     lovetravel
     Version:      2.5
     License:      http://www.nicdarkthemes.com
     License URI:  http://www.nicdarkthemes.com
     Tags:         light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
     Text Domain:  lovetravel-child
    */
    

    The only required child theme file is style.css, but functions.php is necessary to enqueue styles correctly, check the next step.

    3. Create the Functions.php

    The first line of your child theme’s functions.php will be an opening PHP tag (<?php), after which you can enqueue your parent and child theme stylesheets.
    Since our themes uses more css files to hold all of them you will have to make sure to maintain all of the Parent Theme dependencies adding a wp_enqueue_scripts action and use wp_enqueue_style().
    In Love Tavel for example you will have:

    <?php
    
    add_action( 'wp_enqueue_scripts', 'enqueue_parent_theme_style' );
    function enqueue_parent_theme_style() {
     wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
     wp_enqueue_style( 'responsive', get_template_directory_uri() . '/css/nicdark_responsive.css' );
     wp_enqueue_style( 'nicdark_elusive_icons', get_template_directory_uri() . '/framework/ReduxCore/assets/css/vendor/elusive-icons/elusive-icons.css' );
    
    }
    

    4. Activate the child theme

    Your child theme is now ready for activation. Log in to your site’s administration panel, and go to Administration Panels > Appearance > Themes. You should see your child theme listed and ready for activation.

     

    If your WordPress installation is multi-site enabled, then you may need to switch to your network administration panel to enable the theme (within the Network Admin Themes Screen tab). You can then switch back to your site-specific WordPress administration panel to activate your child theme.)

     

    Note: You may need to re-save your menu (Appearance > Menus, or Appearance > Customize > Menus) and theme options (including background and header images) after activating the child theme.

     

     

    Then you go to Appearance > Themes to choose the child theme, if you upload your theme your changes will not be changed by the update.

    Examples

    lovetravel-child

    Copyright 2016 Clean Themes Studio - PI 04892530280