Blog Menu
I write and curate content for Bluehost. I hope this blog post is helpful.
Are you looking at creating a blog, website or an online store? Bluehost has something for everyone. Get started today.

Did you know that 85% of WordPress users modify their themes? They often face a common issue: The need to customize their website without affecting the integrity of the parent theme. That’s because direct modifications to the parent theme can create a number of problems, such as compatibility issues.

In contrast, creating a WordPress child theme lets you customize your website while preserving the core functionality and structure of the existing theme. How, exactly?

In this guide, you’ll learn how to use WordPress to create a child theme without hiccups. Plus, you’ll see how this approach ensures compatibility with plugins, enables easy updates and simplifies maintenance.

What is a child theme?

WordPress themes are file packages that add new code to alter a website’s visual appearance. A WordPress child theme inherits its functionalities from another theme: The parent theme. This way, you can change parts of the child theme without messing with the original theme.

So, what can you customize with a child theme? Various aspects of your WordPress website, including template files and custom CSS styles (e.g.: background color). You can add new functions or override the existing parent theme’s functions.

Where are child themes stored?

Child themes cannot run on their own; they need to be stored in a folder adjacent to the parent theme. The separate storage means you can customize the child theme without altering the core files stored in the parent theme folder.

Use the child theme to customize your website’s visuals and functionality with your own tweaks. You’ll continue to receive improvements and updates to the original parent theme.

Can you install multiple child themes?

You can’t create a child theme from multiple parent themes. On the other hand, there is no limit to the number of child themes you can create from a parent theme.

Using multiple child themes is useful for trying various designs on different pages and their sections. However, do remember that you can only activate one child theme at a time.

What if you delete the parent and child themes?

If you delete the parent theme, your child theme will not work properly as it will lose the features it inherits from the parent. In contrast, deleting the child theme will make your website revert to your parent theme.

The pros and cons of using a child theme in WordPress

A person creating a post on WordPress.
Source

Many web admins like to customize their websites using child themes. Weigh the following pros and cons of WordPress child themes to decide if it’s a good approach for you.

The advantages

With a child theme, you can make changes from your WordPress dashboard, which saves time. Without a child theme, you’ll usually have to download the parent theme’s files via cPanel or FTP to make changes for customization. That process involves making modifications offline, then uploading your files again — which takes longer.

With a child theme, you avoid compatibility issues on your website. Some plugins depend on specific functions or hooks within the parent theme. If you modify the wrong thing, your website can stop working properly. But even if something goes awry with your child theme, your parent theme won’t be affected.

Human error can never be ruled out. If you make a mistake while tweaking your parent theme, it may take time to rectify. In contrast, if you make a mistake with the child theme, you can easily revert back to the original functionality of your parent theme.

By using a child theme, you contribute to a clean and organized codebase. All your customizations are contained within separate files, making it easier to manage and maintain your code.

The disadvantages

Working with a child theme requires a deeper understanding of WordPress development. For example, you need to know specifically how child themes override the style and functionality of your parent theme. This guide will help — so will coding fundamentals and an understanding of the WordPress ecosystem.

Separately managing the parent and child themes introduces more steps to your workflow and maintenance. Building and maintaining a child theme takes additional time and effort compared to modifying the parent theme directly.

Child themes’ updates are dependent on the parent theme. If a parent theme doesn’t get updated, the reduced security and compatibility will apply to the child theme as well. On the other hand, updates to the parent theme can potentially introduce conflicts or break the functionality of the child theme. In the worst-case scenario, you’d have to find a new parent theme, which takes time.

The customization scope of a child theme is limited by the parent theme’s design and structure. If your critical needs aren’t met by your parent theme, you’ll have to spend a lot of time coding to get your child theme up to standard. Or you’ll have to pick a new parent theme.

How to create a child theme in WordPress

You can create a WordPress child theme in three ways: Install a plugin, hire a theme developer, or manually create your child theme.

For website owners without IT experience and coding knowledge, the first two steps are more convenient.

Use a plugin

Many plugins help you create a child theme, even if you have minimal knowledge. It’s a quick and simple way for beginners to create child themes without having to deal with coding or configuration.

For instance, here’s the installation process for the Generate Child Theme plugin:

  • From the WordPress dashboard, navigate to Plugins > Add New
  • In the search box, look for Generate Child Theme
  • Click on Install Now
  • In the dashboard menu, click the Activate button
  • Via the dashboard menu, navigate to the plugin to start using it

Then, all you have to do is enter relevant details into the provided fields, some as simple as the name of your parent theme or a description of the theme.

Plugins are a straightforward option. If you’d rather create something more custom, recruit help.

Hire a theme developer

An experienced theme developer can make a custom WordPress theme precisely according to your preferences. Or they can offer you pre-built themes that align with your business.

Either way, they’ll usually handle the entire process of installing and configuring the theme. Additionally, the better developers will provide you with instructions on how you can customize different aspects of your child theme using simple steps.

For website administrators with IT knowledge or for those who prefer a hands-on approach, consider the following step-by-step method of creating a WordPress child theme. This is especially ideal for users who want complete control over how their website is customized.

How to create a WordPress child theme manually

WordPress code displayed on a laptop screen.
Source

Technical users can create a WordPress child theme by setting up the child theme folder, creating a stylesheet and enqueuing it, installing the theme via FTP and activating it via WordPress admin settings.

Don’t start without taking the following precautions.

Before you start

Back up your website: Manually creating a basic child theme requires some coding, so it’s important to have a backup as a contingency plan. Here’s how you back up your WordPress website.

Create a staging environment: A staging environment is a clone of your live website. In this way, you can test new child themes and their features without affecting your main website. Follow this tutorial to create a staging website.

Learn some basic coding: Working with child themes requires some fundamental know-how of coding. You need to know HTML, CSS, JavaScript and PHP.

Once you are done with the above instructions, create your child theme manually by following these steps:

1. Make the child theme folder

Start by creating a new folder in the themes directory of your WordPress installation, named wp-content/themes. Name the child theme folder by appending “-child” to the name of the parent theme. For instance: If your parent theme is OceanWP, then name its child theme oceanwp-child.

2. Create a stylesheet

In the child theme folder, add a stylesheet file named style.css. Your theme’s visuals are dictated by the CSS rules and declarations written in this new file. Using OceanWP as an example again, here’s what your stylesheet must contain:

/*
Theme Name: OceanWP Child
Theme URI: http://abcshopping.com/oceanwp-child/
Description: OceanWP Child Theme
Author: Jane Doe
Author URI: http://abcshopping.com
Template: oceanwp
Version: 2.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
Text Domain:  oceanwp-child
*/

Keep two things in mind to avoid errors in the future. First, choose a unique name for your child theme. Second, your template name should be the name of your parent theme directory.

3. Enqueue the stylesheet

The final step is to enqueue the stylesheets of your parent and child themes. Enqueuing in this context refers to correctly setting your child theme’s location in WordPress, then specifying the child theme as a dependency in the parent theme’s stylesheet. This process helps load both themes in the right order so that the child theme can inherit or override the parent theme’s styles.

The best way to enqueue stylesheets is to go to functions.php in your child theme and add an action for enqueue_scripts to use wp_enqueue_style().

In functions.php, your first line should start with a PHP tag, which should be followed by the PHP code.

If the parent theme loads its style using a function that starts with get_template, then your child theme has to load its style using the parent’s handle. In contrast, if the parent theme loads its style with a function that starts with get_stylesheet, then your child theme has to load stylesheets for both the parent and child themes.

Use the following code snippet as a reference:

<?php
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
	$parenthandle = 'parent-style'; // This is 'OceanWP' for the OceanWP theme.
	$theme        = wp_get_theme();
	wp_enqueue_style( $parenthandle,
		get_template_directory_uri() . '/style.css',
		array(),  // If the parent theme code has a dependency, copy it to here.
		$theme->parent()->get( 'Version' )
	);
	wp_enqueue_style( 'child-style',
		get_stylesheet_uri(),
		array( $parenthandle ),
		$theme->get( 'Version' ) // This only works if you have Version defined in the style header.
	);
}

4. Install the child theme

Use any of the regular methods of installing WordPress themes. You can use FTP to copy your child theme folder. Or, you can generate a zip file of your folder, select the option to maintain folder structure and upload the zip file to WordPress in Appearance > Themes > Add New.

5. Activate the child theme

In the WordPress admin panel, head to Appearance > Themes, then activate your child theme.

How to troubleshoot a child theme in WordPress

Here’s a head start on troubleshooting child theme errors in WordPress.

At some point, you may come across errors while working with a child theme. Here’s how to troubleshoot the most common ones.

Error #1: The child theme fails to override the parent theme

Generally, once you start making changes to your child theme, it should override your parent theme’s corresponding functionalities and styles. If you don’t see these changes on your website, it’s likely that your stylesheet has failed to load in the correct order.

This happens when there is an error in the functions.php or style.css file. Even if you add the correct code for your customizations, your website won’t load them unless you fix these files.

You can troubleshoot this issue by navigating to the child theme folder and going to the wp-content/themes directory. Now, open the functions.php file and go to the enqueuing function. Here’s what to look for:

<?php
add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );
function enqueue_parent_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
?>

First, make sure there are no typos in this code. If everything’s alright, go to the child theme’s stylesheet. Verify that the template line contains the name of your child’s parent theme. If it doesn’t, then your child won’t inherit the parent theme.

Error #2: The child theme fails to load the latest updates from the stylesheet

What if you uploaded your latest update to the style.css file and the changes don’t reflect on your website, even though previous changes did? A caching issue can be the underlying cause of this error. Your first course of action should be to flush your browser’s cache.

If the website still fails to load the latest updates, then flush your website’s cache. If the problem still persists, you might have a different root cause.

It’s possible that your parent theme’s style.css file is overruling the changes that you made in the child theme’s stylesheet. You can rectify this error by adding !important in your child theme’s stylesheet for the CSS styles that aren’t working.

For context, !important is a CSS property value that directs the browser to ensure a specific style takes precedence. From now on, the child theme’s styles with !important will override the parent theme’s styles.

Final Thoughts: Use Bluehost Maestro to manage your WordPress sites

Bluehost Maestro helps you manage several complex WordPress websites at a time.
Screenshot

In a nutshell, WordPress child themes offer a powerful solution to a common issue faced by website owners. With child themes, you can maintain your parent theme’s integrity even with endless tweaks to your website.

You can use Bluehost Maestro to create staging websites for your child theme, enabling smooth testing of your changes.

Would you like help managing your WordPress website, especially if you have many usernames, passwords, updates, patches, plugins and theme options to work with? Bluehost Maestro solves that too. What makes this platform special is its capability to serve multiple WordPress sites via a single, centralized dashboard.

This means you save time with a streamlined workflow. Sign up to get Maestro for free.

WordPress child theme FAQs

How much coding do I need to know to modify my child theme?

The level of coding knowledge required will vary depending on the extent of customizations you want to make. A basic understanding of HTML, CSS and PHP is typically sufficient for common modifications, while more complex changes may require advanced coding skills.

Can child themes slow down my website?

Yes. Sometimes, websites load slower after a child theme is installed. In most cases, your audience won’t notice because the difference is so small. Still, monitor your website’s load time and work on minimizing delays. To improve your website’s speed, try code minification, caching and image optimization.

Are there any security issues with child themes?

Child themes themselves do not introduce security issues. However, if the custom code you add to your child theme is not secure, or if you don’t keep your child theme and parent theme updated, there’s potential for security vulnerabilities. If you are unsure about your website’s security, ask a cybersecurity expert to review your website and identify any potential vulnerabilities in its code.

Can I create a child theme for a theme that is no longer actively maintained?

Yes. However, it’s important to note that if the parent theme develops security vulnerabilities or compatibility issues, they won’t be addressed or updated by the theme developers. To make sure you don’t choose the wrong parent theme, look for reliable themes in the Bluehost Marketplace.

  • Tiffani Anderson

    Tiffani is a Content and SEO Manager for the Bluehost brand. With over 10 years experience across all facets of content and brand marketing, she strives to combine concepts from brand marketing with engaging content through the lens of SEO.

    Education
    University of North Texas
    Previous Experience
    Content Marketing, SEO, Social Media
Learn more about Bluehost Editorial Guidelines

2 Comments

  1. beingpraneet Reply

    Great,seems i have to install a child theme and then i have to customize it to avoid loss in future. Thanks for sharing

Write A Comment