Step-by-step Guide to Installing a WordPress Child Theme

Creating a child theme in WordPress is an essential skill for customizing your website without risking your main theme. This step-by-step guide will walk you through the process of installing a WordPress child theme safely and efficiently.

What is a WordPress Child Theme?

A child theme is a theme that inherits the functionality and styling of a parent theme. It allows you to make modifications without altering the original theme files, ensuring updates to the parent theme won’t overwrite your customizations.

Step 1: Create a Child Theme Folder

Using an FTP client or your hosting file manager, navigate to /wp-content/themes/. Create a new folder and name it after your parent theme with -child appended. For example, if your parent theme is twentytwentyone, name the folder twentytwentyone-child.

Step 2: Create style.css File

Inside your child theme folder, create a new file named style.css. Add the following header comment at the top:

/*

Theme Name: Twenty Twenty-One Child

Template: twentytwentyone

Version: 1.0

*/

Replace Theme Name and Template with your actual theme names. Save the file.

Step 3: Create functions.php File

In the same folder, create a functions.php file. Add this code to enqueue the parent theme styles:

<?php

add_action( ‘wp_enqueue_scripts’, ‘enqueue_parent_styles’ );

function enqueue_parent_styles() {

wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ );

}

?>

Step 4: Activate Your Child Theme

Log in to your WordPress admin dashboard. Navigate to Appearance > Themes. You should see your child theme listed. Click Activate.

Optional: Customize Your Child Theme

Now that your child theme is active, you can add custom styles to style.css or override template files by copying them from the parent theme into your child theme folder and editing as needed.

Creating a child theme is a safe way to customize your website while keeping your modifications update-proof. Follow these steps to ensure a smooth setup process.