Skip to main content
.com domains from $2.99 — free WHOIS privacy on every name

Theme engineering · Intermediate · 30 minutes

How to create a child theme — One Line in style.css Does All the Inheriting

Your customisations vanish every time the theme updates, and you want the mechanism rather than a copied snippet you cannot debug.

The short answer

A child theme is a folder containing a style.css whose header carries `Template: parent-theme-folder-name` — that single line is the entire inheritance mechanism, and everything else is convention. WordPress then loads the parent for anything the child does not define, and your changes live in a directory the updater never touches.

Two details decide whether it behaves: enqueue the parent stylesheet once from functions.php rather than importing it with @import, and override templates by copying the parent's file to the identical relative path inside the child. Get those right and the child theme is invisible until you deliberately change something.

By the HostingFast team · Reviewed 24 August 2026

Intermediate

Assumed skill

30 minutes

Time at the keyboard

5

Stages in the runbook

24/7

Engineers on shift

This assumes you can create files over SFTP or in File Manager and read a PHP function without flinching. It is short because the mechanism is short — the length in most tutorials comes from ceremony, not necessity.

It also says where a child theme is the wrong answer. On a block theme, most of what people build child themes for is now stored in the database and already survives updates.

What the Template line actually does

Create a folder in wp-content/themes and put a style.css in it whose header block includes `Template: parent-theme-folder-name`. WordPress reads that header, registers the theme as a child, and from then on resolves every template lookup in the child first and the parent second. The value is the parent's folder name, not its display name — this is where most first attempts fail.

Nothing else is required for inheritance. A screenshot.png and a Theme Name line make it presentable in the admin, but the functional part is one header field and a directory.

Enqueue the parent once, and only once

Add a functions.php that hooks wp_enqueue_scripts and loads the parent stylesheet with wp_enqueue_style, using get_template_directory_uri() for the parent and get_stylesheet_directory_uri() for the child. Pass the theme version as the version argument so cache-busting follows your releases rather than a random query string.

The old @import approach still functions but serialises the two stylesheets: the browser must fetch and parse the child before it discovers it needs the parent. On a render-blocking resource that is a measurable delay to first paint, which is why it stopped being recommended.

Overriding by path, not by patch

For CSS, write into the child's style.css. For templates, copy the parent's file into the child at the same relative path — single.php, or template-parts/content/content-single.php — and edit the copy. WordPress prefers the child's version wherever one exists, with no registration step involved.

Copy only what you are changing. Every template you duplicate is a file you have now taken responsibility for maintaining against future parent updates, which is the hidden running cost of a child theme with forty files in it.

When a child theme is the wrong tool

On a block theme, full-site editing stores your customisations in the database, beyond the reach of an update. For colours, typography, templates and template parts, the site editor is now the right place and a child theme adds a directory for no benefit. Child themes remain correct for code: custom functions, hooks, template parts the editor cannot express.

If you are retrofitting one onto a parent that has already been edited directly, find those edits before the next update destroys them. Download a clean copy of the same parent version and diff it against the live folder — every change reveals itself in one pass, and SSH with Git on the developer plans makes that a two-minute job.

A developer working against a hosted server over SSH

The toolchain these steps assume

Tutorials written against imaginary hosting rot fast. This one was written against the real thing: the same panel, the same file manager and the same SSH access sitting in your account right now.

NVMe storage and LiteSpeed caching power every tier, from the smallest plan up — speed is the baseline here, not an upsell.

  • SSH, Git and Composer on the developer-focused plans
  • Staging environments for testing changes before they ship
  • Per-site PHP version switching from the control panel
  • Human support on duty every hour of every day

Why HostingFast

Standard on every plan

The mechanism, not a snippet

You leave knowing which single header line creates the inheritance, which means you can debug it when it fails.

The enqueue done the fast way

wp_enqueue_style with the right directory helpers, and why @import costs you a render-blocking round trip.

Override by path

Copy the parent's template to the identical relative path — no registration, no filter, no guesswork.

Maintenance cost named

Every duplicated template is a file you now maintain against parent updates, so the guide says to copy sparingly.

Knows when to say no

On a block theme most of this belongs in the site editor, and the page says so instead of selling you a folder.

Scoped honestly

Building and wiring a child theme is an intermediate job — about 30 minutes, most of it in functions.php.

Quick Start

From order to online

  1. 1

    Create the folder and the style.css header

    A new directory in wp-content/themes with a style.css whose header includes `Template: parent-theme-folder-name`. The value is the parent's folder name, not its display name — that mismatch is the classic first failure.

  2. 2

    Enqueue the parent stylesheet from functions.php

    Hook wp_enqueue_scripts and load the parent with wp_enqueue_style, using get_template_directory_uri(). Pass a version string so cache-busting tracks your releases rather than appending noise.

  3. 3

    Activate and confirm nothing changed

    Switch to the child under Appearance, then Themes. The site should render identically — a correctly built child theme is invisible until you override something on purpose.

  4. 4

    Override CSS first, templates second

    Put styles in the child's style.css. For markup, copy the parent's template to the same relative path in the child and edit the copy. Copy only the files you are actually changing.

  5. 5

    Retrofit safely if the parent was edited directly

    Download a clean copy of the same parent version and diff it against the live folder. Move every found change into the child before the next update overwrites it — SSH and Git make this a two-minute pass.

Built In

Loaded onto every plan

  • SSH, Git and Composer on the developer-focused plans
  • Staging environments for testing changes before they ship
  • Per-site PHP version switching from the control panel
  • NVMe SSD storage on every tier, not just the expensive ones
  • LiteSpeed caching built into the server rather than patched in by plugin
  • Daily backups, with self-service restores you run from the panel
  • WordPress Toolkit, with updates handled for you
  • cPanel — the control panel most of the industry already runs
  • Human support on duty every hour of every day
  • Money-back cover: 30 days on hosting plans, 7 on reseller

Frequently Asked

What people ask us most often

Does @import versus wp_enqueue_style make a measurable difference?

Yes, on first paint. @import inside the child stylesheet means the browser has to fetch and parse that file before it even learns the parent stylesheet exists, so the two render-blocking requests happen in series rather than in parallel. Enqueueing both properly lets them be discovered together. It is not a huge number, but it is a free one.

Do block themes make child themes pointless?

For colours, typography and templates, largely yes — full-site editing stores those in the database where updates cannot reach them, so a child theme adds a folder and no protection. Child themes stay the right tool for code: custom functions, hooks, and template parts the site editor has no way to express.

Does hosting include mailboxes on my own domain?

Yes — every plan includes mailboxes on your domain, with webmail, IMAP, POP and SMTP plus spam filtering on from the start. There is also standalone email hosting for a domain whose website lives somewhere else entirely.

Where does the platform physically run?

From a London datacentre with redundant power, cooling and multiple upstream carriers, fronted by server-level caching that keeps cached pages quick for visitors anywhere. For most sites the engineering matters more than the pin on the map — NVMe disks, LiteSpeed, and restrained account density per machine move the numbers further than geography does.

Keep reading

  • How to Protect Forms From Spam

    Stop the bot traffic hitting your form endpoint without making genuine visitors prove themselves — beginner, roughly 30 minutes.

  • How to Create an Email Account in cPanel

    Create a working mailbox on your own domain, with a quota that will not bounce, and test it both ways — beginner, about 5 minutes.

  • Best Cheap WordPress Hosting

    The shortlist with the reasoning shown: which specifications change the numbers and which are there to fill a table.

  • Secure Hosting

    Imunify360, isolated accounts and hardened defaults for security-first builds.

  • Plesk Hosting

    Shared hosting on Plesk for anyone who would rather not use cPanel.

Changing hosts? Run through our checklist first.

A straightforward sequence for a switch your visitors never feel: which files move first, how to shift email across without losing a single message, the right moment to repoint DNS, and the two mistakes behind almost all the downtime we get asked to rescue.

You'll get the checklist email, then occasional pointers on keeping a site running fast. Unsubscribe the moment you want out — the privacy policy covers the rest.

Build themes where SSH is included.

SSH, Git and Composer on developer plans, staging clones, per-site PHP control and daily backups — on NVMe behind LiteSpeed.

View Secure Hosting plans