Create child theme in wordpress

WordPress Structure, Wordpress Tutorials

Create child theme in wordpress

child theme in wordpress

Why use a Child Theme In WordPress?

There are a few reasons why you would want to use a child theme in WordPress:

  • If you modify a theme directly and it is updated, then your modifications may be lost. By using a child theme you will ensure that your modifications are preserved.
  • Using a child theme can speed up development time.
  • Using a child theme is a great way to learn about WordPress theme development.

How to Create a Child Theme

A child theme consists of at least one directory (the child theme directory) and two files (style.css and functions.php), which you will need to create:

  • The child theme directory
  • style.css
  • functions.php

The first step in creating a child theme is to create the child theme directory, which will be placed in wp-content/themes. It is recommended that the name of your child theme directory is appended with ‘-child’. You will also want to make sure that there are no spaces in your child theme directory name, which may result in errors. In the screenshot above we have called our child theme ‘Helpyouforever-child’, indicating that the parent theme is the helpyouforever theme.

The next step is to create a style.css file that must start with some commenting code that comment contains the child theme information and that code looks like as below.

 Theme Name:   Helpyouforever Child
 Theme URI:
 Description:  Helpyouforever Child Theme
 Author:       Mahesh and Gaurang
 Author URI:
 Template:     helpyouforever
 Version:      1.0.0
 License:      GNU General Public License v2 or later
 License URI:
 Text Domain:  helpyouforever-child

The final step is to enqueue the parent and child theme stylesheets. The correct method of enqueuing the parent theme stylesheet is to add a wp_enqueue_scripts action in your child theme’s functions.php. You will, therefore, need to create a functions.php in your child theme directory. If your child theme has more than one .css file (eg. ie.css, style.css, main.css) then you will have to make sure to maintain all of the Parent Theme dependencies.

add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );


If your child theme style.css contains actual CSS code (as it normally does), you will need to enqueue it as well. Setting ‘parent-style’ as a dependency will ensure that the child theme stylesheet loads after it. Including the child theme, version number ensures that you can bust cache also for the child theme.

function theme_enqueue_styles() {

    $parent_style = 'parent-style'; // This is 'Helpyouforever-style' for the Helpyouforever theme.

    wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( 'child-style',
        get_stylesheet_directory_uri() . '/style.css',
        array( $parent_style ),
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );


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.)

That is all about the child theme in WordPress. If you still need confusion then you can comment on that post we will reply you and also can refer the official website.

8 thoughts on “Create child theme in wordpress

  1. Definitely believe that which you stated. Your favorite justification seemed to be on the net
    the easiest thing to be aware of. I say to you, I certainly get annoyed while
    people think about worries that they just do not know about.
    You managed to hit the nail upon the top and also defined out the whole
    thing without having side-effects , people can take a signal.
    Will likely be back to get more. Thanks

  2. A lot of thanks for all of your hard work on this website. My mother enjoys working on internet research and it’s simple to grasp why. Most people hear all concerning the dynamic tactic you render priceless tips and hints through this web site and in addition improve response from some others about this area of interest then our own princess is in fact discovering so much. Take pleasure in the remaining portion of the new year. You’re doing a stunning job.

  3. Hello would you mind letting me know which webhost you’re
    utilizing? I’ve loaded your blog in 3 comlletely different web browsders
    and I must say this blog loads a lot quicker then most.
    Can you recommend a good web hosting provider at a fair price?
    Thaanks a lot, I appreciate it!

  4. I just wanted to write down a quick word in order to express gratitude to you for those amazing concepts you are giving here. My extensive internet investigation has at the end of the day been compensated with reasonable facts and techniques to exchange with my friends and classmates. I would assume that many of us readers actually are unquestionably blessed to be in a fine place with so many outstanding professionals with beneficial opinions. I feel somewhat lucky to have seen your entire website and look forward to really more fabulous minutes reading here. Thanks once again for everything.

  5. I simply desired to appreciate you once again. I’m not certain the things that I could possibly have done in the absence of the actual thoughts revealed by you over such a subject matter. Previously it was an absolute distressing concern for me personally, but spending time with a new skilled approach you dealt with the issue took me to leap over fulfillment. I am grateful for this support and thus hope you are aware of a great job you are always putting in teaching others via your web page. I’m certain you’ve never got to know all of us.

  6. This blog is definitely rather handy since I’m at the moment creating an internet floral website – although I am only starting out therefore it’s really fairly small, nothing like this site. Can link to a few of the posts here as they are quite. Thanks much. Zoey Olsen

  7. Great – I should certainly pronounce, impressed with your website. I had no trouble navigating through all the tabs as well as related information ended up being truly easy to do to access. I recently found what I hoped for before you know it at all. Quite unusual. Is likely to appreciate it for those who add forums or something, website theme . a tones way for your customer to communicate. Nice task.

Leave a Reply