Sunday, November 29, 2026

Shahroz Blog PK

Tech | Blogging | Business | Lifestyle | More

Trending Now

How to Create a Child Theme in WordPress (and Why You Should)

3 min read No comments

If you have ever customised your WordPress theme’s code, such as adding CSS or editing template files, and then lost all your changes after a theme update, you know how frustrating it is. The solution is a child theme. It lets you make customisations safely while still receiving updates for the original theme. Here is a beginner-friendly guide.

What is a child theme?

A child theme is a theme that inherits the design and functionality of another theme, called the parent theme. Your custom changes live in the child theme, so when the parent theme updates, your changes stay intact.

Do you need a child theme?

  • Yes, if you plan to edit theme files like functions.php, header.php or templates.
  • Yes, if you are adding a lot of custom CSS or PHP.
  • Maybe not, if you only use the Customizer, the Site Editor for block themes, or the “Additional CSS” box, since these settings are generally preserved during updates.
  • Check first: many popular themes offer a ready-made child theme you can download from the developer’s website.

Before you start

  • Back up your website using your host’s backup tool or a backup plugin.
  • Ideally, test changes on a staging site first.
  • Know your parent theme’s folder name (found in /wp-content/themes/).

Method 1: Using a plugin (easiest)

Free plugins such as Child Theme Configurator can create a child theme in a few clicks:

  1. Go to Plugins > Add New and search for a child theme plugin.
  2. Install and activate it.
  3. Follow the plugin’s steps to select your parent theme and create the child theme.
  4. Activate the new child theme under Appearance > Themes.
  5. Deactivate the plugin when done if you no longer need it.

Method 2: Manual creation

Step 1: Create a folder

Using your hosting File Manager or an FTP client, go to /wp-content/themes/ and create a new folder, for example astra-child if your parent theme is Astra.

Step 2: Create style.css

Inside the folder, create a file named style.css with this header:

/*
Theme Name: Astra Child
Template: astra
Version: 1.0
*/

The Template line must exactly match the parent theme’s folder name.

Step 3: Create functions.php

Create a functions.php file to load the parent theme’s styles:

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

Some themes load their styles differently; check your theme’s documentation.

Step 4: Activate the child theme

Go to Appearance > Themes, find your child theme and click Activate. Check your site to ensure everything looks correct.

Customising your child theme

  • CSS: add custom styles to the child theme’s style.css.
  • PHP functions: add code snippets to the child theme’s functions.php.
  • Templates: copy a template file from the parent theme into the child theme folder, then edit the copy. WordPress will use the child version.

Tips and precautions

  • A small PHP error can break your site. Edit using File Manager or FTP, not only the dashboard editor, so you can fix mistakes.
  • Keep a copy of the original file before editing.
  • After activating, re-check menus and widgets, as some settings may need reassigning.
  • Keep both parent and child themes installed; deleting the parent will break the child.

Final thought

A child theme takes just a few minutes to set up but can save you hours of frustration later. If you plan to customise your theme, make it one of your first steps.

📢 Share this with friends:

admin

Leave a Comment

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

100+
Helpful Articles
50+
Categories
10K+
Monthly Readers
100%
Free Resources
📢 Share: WhatsApp Facebook