Blog · WebJi® India

WordPress Child Themes: Why & How

Quick answer: Create a folder in wp-content/themes named after the parent with -child added, add a style.css whose Template line names the parent folder exactly, enqueue the parent stylesheet from functions.php, then activate the child theme. Updates then overwrite the parent folder only — your customizations survive.
✓ In business since 2005✓ INR + GST billing✓ 24/7 Email Support — avg reply < 60 min
Indian small-business owner packing courier boxes beside a laptop running his online store — how to create a child theme

If you edit theme files at all — a template tweak, a new function, custom CSS beyond a few lines — a child theme is what keeps those edits alive through theme updates. This guide covers the two files a child needs, the activation steps, the correct way to load parent styles, and the plugin routes when you would rather not touch code.

What a Child Theme Is (Update-Safe Customizing)

A child theme is a small theme that inherits everything — templates, styles, features — from an installed parent theme, but overrides it wherever you add your own files. The point is updates: WordPress replaces the parent theme's folder every time the theme updates, so any edit made directly in the parent is wiped. Edits made in the child sit in a separate folder the updater never touches.

  • Customizations stay portable and separated from vendor code.
  • Parent updates apply without losing your work.
  • You only write the code you actually need.

For a handful of color tweaks, the Customizer's Additional CSS field is enough — a child theme is for template edits, new functionality and anything you would mourn losing.

The 2 Required Files

Strictly, a child theme needs one file: style.css. In practice classic themes also get a functions.php so the parent's stylesheet still loads. Both files go in a new folder under wp-content/themes, named after the parent with -child appended (for example astra-child).

FileRequired?What goes inside
style.cssYesA header comment with Theme Name and Template: — the Template line must be the parent's exact folder name (e.g. astra), or the child will not bind
functions.phpFor classic themesAn enqueue snippet that loads the parent stylesheet — pattern in the next section

The Template header is the one line people get wrong. It must match the parent's folder name — not the theme's display name — character for character. Check it under Appearance → Themes → Theme Details or by listing wp-content/themes.

Indian small-business owner packing courier boxes beside a laptop running his online store — how to create a child theme

Step-by-Step: Create and Activate

The working sequence, verified end to end:

  1. Locate the parent's folder name — Appearance → Themes → theme details shows the slug (e.g. astra).
  2. Create wp-content/themes/astra-child via File Manager or SFTP.
  3. Add style.css with the header above (Template: astra).
  4. Add functions.php enqueueing the parent style with wp_enqueue_style hooked to wp_enqueue_scripts, using get_stylesheet_directory_uri() for the child's own CSS.
  5. Activate the child; verify the site renders identically to before.
  6. Begin customising: template overrides are copies of parent files placed in the child folder with the same path.

Test on staging the first time — a typo in the Template line activates an orphan theme, which is a five-second fix you would rather discover off-production.

Enqueue Parent Styles Correctly

In the child's functions.php, hook wp_enqueue_scripts and load two stylesheets: the parent's via get_template_directory_uri() . '/style.css' and your child's via get_stylesheet_directory_uri(), registering the child style as dependent on the parent so the cascade order is right. Two rules matter. Never use @import inside style.css — it serializes requests and slows the page. And never copy function code out of the parent's functions.php: functions.php files do not override each other, parent and child both load with the child first, so duplicated function names cause fatal errors.

Block themes (the full-site-editing kind) often skip this file entirely — their styles live in theme.json, which the child inherits unless you add one of your own.

Overriding Templates (Copy and Edit)

To change a template, copy the file from the parent theme into your child folder at the same path — header.php, single.php, footer.php, whatever you need — then edit the copy. WordPress checks the child theme first for every template in the hierarchy, so the copy wins and the original stays untouched for the next update.

Brand-new templates (a landing-page layout, a custom post type template) also belong in the child. Make one override at a time and test in a private window; an incomplete copy of a template can blank the page until you restore it.

No-Code Alternatives (Custom CSS, Plugins)

Three routes avoid hand-editing files altogether. The free Child Theme Configurator plugin (over 300,000 installs) generates the child from Tools → Child Themes, scans the parent for dependencies and can copy your widgets and Customizer settings across — take a backup first.

Many theme vendors ship ready-made child themes: Hello Elementor publishes one on GitHub, and Astra, GeneratePress and OceanWP all offer generators or downloads. And for changes that should survive switching themes entirely (a custom post type, a shortcode), a snippets plugin that stores code in the database beats a child theme — theme-attached code is the wrong home for it.

Child Themes vs Block Themes (FSE Note)

Block themes — the full-site-editing kind like Twenty Twenty-Four — change the picture. Their design comes from theme.json rather than a stylesheet, so a child of a block theme still declares the Template: header but usually carries a theme.json of its own instead of an enqueue snippet. Overrides work the same way: same filename, child wins.

One caution from the WordPress handbook: a child theme that keeps growing template after template is a sign you have outgrown the parent — at that point forking the parent into your own theme is the cleaner path than maintaining a shadow copy. Non-developer teams usually hand this layer to a WordPress web design service instead of accumulating overrides.

Frequently Asked Questions

How do I create a child theme in WordPress?

Create wp-content/themes/yourtheme-child, add a style.css whose Template: line matches the parent folder exactly, add a functions.php that enqueues the parent stylesheet, then activate the child under Appearance → Themes. The free Child Theme Configurator plugin can generate both files for you.

Why should I use a child theme?

So your edits survive theme updates. Changes made in the parent theme's files are wiped every time the theme updates; a child theme keeps them in a separate folder the updater never touches.

What files does a child theme need?

Only style.css — with a header naming the parent in its Template field. A functions.php that enqueues the parent stylesheet is the usual second file for classic themes.

Will my changes survive theme updates?

Yes. The updater replaces the parent theme folder only; the child theme lives beside it and is left alone. Re-test after major parent updates, since a reworked parent template may deserve a matching child override.

Can I create a child theme without coding?

Yes. The free Child Theme Configurator plugin builds one from Tools → Child Themes, and many theme vendors (Astra, GeneratePress, Hello Elementor) publish ready-made child themes you can install directly.

How do I enqueue the parent stylesheet correctly?

In the child's functions.php, hook wp_enqueue_scripts and load the parent CSS with get_template_directory_uri(), then the child CSS with get_stylesheet_directory_uri() as a dependent style. Never use @import inside style.css.

Is WebJi® an Indian company?

Yes. WebJi® is headquartered in Jaipur, Rajasthan and has operated since 2005. Billing, support and governance all run from India.

Do you provide GST invoices?

Every purchase and renewal gets a GST invoice with our GSTIN, and hosting prices are quoted exclusive of 18% GST. Claim input credit as applicable.

Need help with this?

WebJi® support does it for you — free. Talk to our Jaipur team →