How to Create a Child Theme in WordPress ? Step-by-Step Guide

A child theme in WordPress is a lightweight theme that inherits all the functionality and styling of a parent theme — but allows you to customize safely without losing your changes after updates.

If you modify your main (parent) theme directly, all edits disappear when you update it.
That’s why creating a child theme is essential for any kind of manual customization.

Step 1: Create a New Folder for Your Child Theme

  1. Connect to your website via FTP or File Manager (from your hosting panel).
  2. Navigate to:
/wp-content/themes/

3. Create a new folder for your child theme.

For example: if your main theme is twentytwentyfive, create a folder named

twentytwentyfive-child

Step 2: Create a style.css File

Inside your new folder, create a file called style.css
Add this header code at the top:

/*
 Theme Name:   Twenty Twenty-Five Child
 Theme URI:    https://example.com/
 Description:  Child theme for the Twenty Twenty-Five theme
 Author:       Your Name
 Author URI:   https://yourwebsite.com/
 Template:     twentytwentyfive
 Version:      1.0.0
*/

The Template value must match the folder name of your parent theme exactly.

(Optional) You can add extra CSS below that comment to style your child theme.

Step 3: Create a functions.php File

In the same folder, create a file called functions.php and add this code:

<?php
// Enqueue parent and child theme styles
function child_theme_enqueue_styles() {
    wp_enqueue_style('parent-style', get_template_directory_uri() . '/style.css');
    wp_enqueue_style('child-style', get_stylesheet_uri(), array('parent-style'));
}
add_action('wp_enqueue_scripts', 'child_theme_enqueue_styles');
?>

What it does:

  • Loads the parent theme’s styles first
  • Then adds your child theme’s custom CSS on top

This ensures your customizations override the original theme design correctly.

Step 4: Activate Your Child Theme

  1. Go to your WordPress dashboard → Appearance → Themes
  2. You’ll see your new “Twenty Twenty-Five Child” theme listed.
  3. Click Activate.

That’s it! Your child theme is now active

Step 5: Add Custom Code or Templates

You can now safely:

  • Add custom PHP in your child theme’s functions.php
  • Add custom CSS in style.css
  • Copy any file from the parent theme (like header.php, single.php, etc.) into your child folder and edit it freely

WordPress will always load your child version first.

Why Use a Child Theme

  • Safe Customization: Updates won’t erase your changes.
  • Clean Structure: Keeps your custom code separate.
  • Easy Debugging: You always know what’s yours.
  • Faster Development: Reuse it for other projects.

Creating a child theme in WordPress takes only a few minutes — but it’s the foundation for all safe and professional customizations.
If you’re adding PHP snippets or changing templates, always use a child theme instead of editing the main one directly.

Leave a Reply

Your email address will not be published. Required fields are marked *