What Is a WordPress Child Theme and How to Create One Using cPanel
What Is a WordPress Child Theme and How to Create One Using cPanel
WordPress child themes allow you to customize your website safely without losing changes when the parent theme updates. This guide explains what child themes are and how to create one manually using cPanel.
What Is a WordPress Child Theme?
A child theme is a separate theme that inherits the functionality and styling of a parent theme. It lets you modify or add to the parent theme’s features without altering the original files. This way, when the parent theme gets updated, your customizations remain intact.
- Safe updates: Preserve customizations when the parent theme updates.
- Easy maintenance: Separate your changes from the core theme files.
- Extend functionality: Add custom CSS, PHP, templates, or scripts.
When Should You Use a Child Theme?
If you plan to:
- Customize your theme’s design or layout.
- Add new features or modify existing ones.
- Ensure your changes don’t get overwritten by theme updates.
How to Create a WordPress Child Theme Using cPanel
Follow these simple steps to create your child theme manually:
Step 1: Log in to Your cPanel Account
Visit https://yourdomain.com/cpanel
and enter your login credentials.
Step 2: Open File Manager
In cPanel dashboard, click on File Manager under the Files section.
Step 3: Navigate to the Themes Directory
Go to your WordPress installation directory, then open public_html/wp-content/themes/
.
Step 4: Create a New Folder for the Child Theme
Click + Folder and name it something like parenttheme-child
(replace parenttheme
with the actual parent theme name).
Step 5: Create the style.css
File
- Inside your new child theme folder, click + File and name it
style.css
. - Edit the
style.css
file and add the following header (replace with your parent theme details):
/* Theme Name: ParentTheme Child Theme URI: http://example.com/parenttheme-child Description: Child theme for the ParentTheme Author: Your Name Author URI: http://example.com Template: parenttheme Version: 1.0.0 */ /* Import parent theme styles */ @import url("../parenttheme/style.css");
Step 6: Create the functions.php
File
- Create another file named
functions.php
in the child theme folder. - Edit it and add this code to enqueue the parent theme stylesheet properly:
<?php function child_theme_enqueue_styles() { wp_enqueue_style('parent-style', get_template_directory_uri() . '/style.css'); } add_action('wp_enqueue_scripts', 'child_theme_enqueue_styles'); ?>
Step 7: Activate Your Child Theme
Log in to your WordPress admin dashboard at https://yourdomain.com/wp-admin
:
- Go to Appearance > Themes.
- You should see your new child theme listed.
- Click Activate to enable the child theme.
Step 8: Customize Your Child Theme
Now you can safely add custom CSS, templates, or PHP functions in your child theme folder without affecting the parent theme.
Benefits of Using a Child Theme
- Keep your customizations safe during updates.
- Easy to revert changes by switching themes.
- Organized and clean approach to theme customization.