How to Create a WordPress Child Theme Print

  • wordpress, child theme, wordpress child
  • 1

You might be asking yourself what is a WordPress Child theme? In short, it's a WordPress theme that inherits it's style, functionality, features, etc. from the Parent theme.

Why Should I Use a Child theme? 
WordPress Child themes are used to retain customizations. This allows you to update your Parent theme without losing those customizations. Another way to look at Child themes is that it allows you to build on a framework that already exists.

For example, you may want to place your Google Analytics tracking code into the footer.php of your Parent theme. If your Parent theme released an update that replaced the original footer.php, your Google Analytics code would need to be added to the footer.php again. However, if you were to use a Child theme and previously added the tracking code to your Child theme's footer.php, the tracking code won't be erased when you upgrade your Parent theme.

Often times, Child themes are used to retain customizations made to the style.css. If you do not have a Child theme and make any customizations to your Parent theme's style.css it would be very tedious task to re-do those customizations every time there was an update released for your theme.

Nowadays, it is now very common to see WordPress themes packaged with a Child theme. If your theme does not have a pre-packaged Child theme you can still create one. Keep in mind that not all Parent themes are good candidates to be used as Parent (framework) themes.

Tip: Parent themes are often times referred to as frameworks or theme frameworks. All WordPress frameworks are parent themes, but not all parent themes are frameworks. Having a good Parent theme framework is very important. Not all WordPress themes were designed to act as a Parent theme or theme framework.

How to Create a WordPress Child Theme
To create a Child theme you'll need to make sure to have access to File Manager or connect to to your site via FTP (File Transfer Protocol). Once you've accessed your site by either method you'll want to follow these instructions below. Please note that it is best practice to use the name of your parent theme (e.g., twentyseventeen) and append the new folder with '-child' (see screenshot below).

  • Navigate to your WordPress theme's directory - public_html > /wp-content/ > /themes/
  • Create a new folder (directory) and name it PARENTTHEME-child
  • Create a stylesheet - style.css - inside the PARENTTHEME-child folder
  • Create a functions.php inside the PARENTTHEME-child folder


WordPress Child Theme

Add these lines to your style.css

/*
Theme Name: Twenty Seventeen Child Theme
Description: A child theme of the Twenty Seventeen default WordPress theme
Author: the WordPress team
Template: twentyseventeen
Version: 1.0.0
*/

Child Theme style.css

Add these lines to your functions.php

<?php
add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );

function enqueue_parent_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
}

Child Theme functions.php

If you plan on adding tracking codes or conversion pixels into your footer.php or header.php we recommend copying the Parent theme's footer.php and header.php and placing those inside of your newly created PARENTTHEME-child folder as well.

Adding a Preview image to your Child theme
Place a .PNG inside of your PARENTTHEME-child folder (directory). This .PNG will be used as your Child theme's preview image when you're logged into your WordPress dashboard and access the Appearance > Themes section.

You'll want to upload a screenshot.png to your Child theme's directory. The recommended dimensions is 880x660.

Child Theme Preview Screenshot

Now that you've successfully create a Child theme you're on your way to safely customizing your WordPress website. If you have any questions or run into any issues creating a Child theme please submit a ticket and one of our support members will be happy to assist you.


Looking for reliable WordPress Hosting with Award Winning Customer Support?
Grab your hosting today with a 20% discount. All plans come with our 60 Money Back Guarantee!

Check out our plans & promotions on our website -- https://www.peopleshost.com/


Was this answer helpful?

« Back