HomeBlog › WordPress Child Theme: Beginner Guide
👶 Development

WordPress Child Theme: Beginner Guide

📅 January 2025⏱️ 10 min✍️ Woops.ai

⚡ Child Theme in 3 Steps

  1. Create new folder in /wp-content/themes/
  2. Create style.css with theme header
  3. Create functions.php to enqueue parent styles

What is a Child Theme?

A child theme is an "extension" of your main theme (parent theme). It inherits all functions and styles from the parent theme, but lets you make custom changes – that are NOT overwritten during theme updates.

Why you need a child theme:

⚠️
NEVER edit the original theme directly!

On the next update, all changes are gone. Always use a child theme for customizations.

What You Need

Create Child Theme: Step by Step

1

Create Folder

Create a new folder in /wp-content/themes/. Name it after the parent theme with "-child" at the end:

/wp-content/themes/astra-child/
2

Create style.css

Create a file style.css in the child theme folder with this content:

/*
 Theme Name:   Astra Child
 Theme URI:    https://yourdomain.com
 Description:  Child Theme for Astra
 Author:       Your Name
 Template:     astra
 Version:      1.0.0
*/

/* Your custom CSS styles here */

Important: "Template" must exactly match the parent theme folder name (lowercase)!

3

Create functions.php

Create a file functions.php to enqueue parent styles:

<?php
function child_theme_enqueue_styles() {
    wp_enqueue_style('parent-style', 
        get_template_directory_uri() . '/style.css'
    );
    wp_enqueue_style('child-style',
        get_stylesheet_directory_uri() . '/style.css',
        array('parent-style')
    );
}
add_action('wp_enqueue_scripts', 'child_theme_enqueue_styles');
?>
4

Activate Child Theme

Go to Appearance → Themes. You'll now see your child theme. Click "Activate".

CSS Customizations in Child Theme

Now you can add custom styles in your child theme's style.css:

/* Change heading color */
h1, h2, h3 {
    color: #0073aa;
}

/* Custom button style */
.button, button {
    background: linear-gradient(135deg, #0073aa, #00a0d2);
    border-radius: 8px;
}

Best Practices for Child Themes

Fix WordPress Problems Faster

AI-powered help for WordPress & WooCommerce.

Try Free →