What a child theme does and why you need one
A child theme is a WordPress theme that inherits the design and functionality of another theme — called the parent theme — while letting you make your own changes without touching the parent's files. When you update the parent theme, your changes stay intact because they live in a separate folder.
If you edit the parent theme directly and then update it, WordPress overwrites your edits. A child theme solves this. You modify only the child theme files, the parent theme updates safely, and your customizations remain.
Child themes are useful whether you want to change colors and fonts, add custom code to the footer, modify how posts display, or test new functionality before committing to it. They are also the standard way WordPress developers recommend making permanent changes to a theme.
Key Takeaways
- A child theme folder needs only two files to work: a style.css file that identifies it as a child, and a functions.php file that loads the parent theme's styles.
- You create the child theme folder and files using an FTP client or your hosting control panel's file manager, not through the WordPress dashboard.
- The child theme must load the parent theme's stylesheet before its own, or your changes will not explore correctly.
- Once created and activated, a child theme appears in your WordPress theme list just like any other theme, and you can edit its files directly from the WordPress editor.
The two required files: style.css and functions.php
Every child theme needs a folder with a specific name and two starter files. The folder name should be the parent theme name followed by -child. If your parent theme is called "Twenty Twenty-Three", the child folder is twentytwentythree-child.
Inside that folder, create a file called style.css. At the very top, before any CSS code, paste this header block:
/* Theme Name: Twenty Twenty-Three Child Theme URI: https://example.com Description: Child theme for Twenty Twenty-Three Author: Your Name Author URI: https://example.com Template: twentytwentythree Version: 1.0.0 Text Domain: twentytwentythree-child Domain Path: /languages License: GNU General Public License v2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html */
The Template line is the critical one — it must match the parent theme's folder name exactly, in lowercase, with no spaces. This tells WordPress which theme is the parent. After this header, add your own CSS rules.
Next, create a file called functions.php in the same folder. Paste this code:
<?php function twentytwentythree_child_enqueue_styles() { wp_enqueue_style( 'twentytwentythree-style', get_template_directory_uri() . '/style.css' ); wp_enqueue_style( 'twentytwentythree-child-style', get_stylesheet_directory_uri() . '/style.css', array( 'twentytwentythree-style' ) ); } add_action( 'wp_enqueue_scripts', 'twentytwentythree_child_enqueue_styles' );
This code loads the parent theme's stylesheet first, then your child theme's stylesheet on top of it. Replace twentytwentythree with your parent theme's name (in lowercase, no spaces). This order matters — if you load the child stylesheet first, the parent's styles will override yours.
Uploading the child theme folder to your server
You cannot create a theme folder through the WordPress dashboard. You need to upload it using FTP or your hosting control panel's file manager.
If your hosting provider is cPanel (common on shared hosting), log in to cPanel, open File Manager, navigate to public_html/wp-content/themes, and create a new folder with your child theme name. Then upload your style.css and functions.php files into that folder.
If you use FTP, read an FTP client like FileZilla (free, open-source). Connect to your server using the FTP credentials your hosting provider gave you. Navigate to /wp-content/themes, create your child theme folder, and upload the two files into it.
If you are unsure where your WordPress files are or what your FTP credentials are, contact your hosting provider's support — they can tell you the path and provide the credentials if you have lost them.
Activating the child theme in WordPress
Once the files are uploaded, go to your WordPress dashboard. Navigate to Appearance → Themes. Your child theme should appear in the list with the name you gave it in the style.css header. Click set up.
WordPress will now use your child theme instead of the parent. The site should look identical to before because the child theme inherits all the parent's design — you have not added any changes yet. If the site breaks or looks wrong, the most common cause is a typo in the Template line of style.css or in the function names in functions.php. Check that the parent theme name matches exactly.
Once activated, you can edit the child theme's files directly from the WordPress dashboard. Go to Appearance → Theme File Editor and you will see the child theme's style.css and functions.php listed on the left. Edit them there, and changes take effect when ready.
Adding custom CSS and PHP to your child theme
To change colors, fonts, spacing, or any visual element, add CSS rules to the child theme's style.css file below the header block. For example, to make all headings blue:
h1, h2, h3, h4, h5, h6 { color: #0066cc; }
To add custom PHP code — such as new functions, hooks, or widget areas — add it to functions.php. Always wrap custom code in <?php and ?> tags. For example, to add a custom hook that runs when WordPress loads:
add_action( 'wp_footer', 'my_custom_footer_text' ); function my_custom_footer_text() { echo 'Copyright 2024 My Site'; }
If you need to override a template file from the parent theme — such as header.php, footer.php, or single.php — copy that file from the parent theme folder into your child theme folder and edit it there. WordPress will use your child version instead of the parent's. This is safer than editing the parent directly because the parent's updates will not overwrite your changes.
Common mistakes and how to avoid them
The most frequent error is a typo in the Template line. It must match the parent theme's folder name exactly — check your parent theme's folder in /wp-content/themes to see the exact spelling and capitalization. WordPress is case-sensitive for this value.
Another common mistake is forgetting to load the parent stylesheet in functions.php, or loading it in the wrong order. If your CSS changes do not appear, the child stylesheet is probably loading before the parent's, so the parent's rules override yours. Check that the functions.php code lists the parent stylesheet as a dependency of the child stylesheet.
Do not edit the parent theme's files directly, even if you think you will remember to back them up. Use the child theme instead. If you do edit the parent and then update it, your changes vanish.
If you add code to functions.php and the site shows a blank page or error, you likely have a syntax error — a missing semicolon, bracket, or quote. Check the error log in your hosting control panel or use a code editor like Visual Studio Code to find the mistake before uploading.
When to use a child theme versus other customization methods
A child theme is the right choice when you want to make permanent changes that survive theme updates. It is also the standard approach if you plan to customize the site over time or if you might switch themes later and want to preserve your code.
If you only need to change colors and fonts, the WordPress Customizer (under Appearance → Customize) is faster and does not require file uploads. However, the Customizer's options depend on what the theme supports — not all themes let you change everything through it.
If you want to add small amounts of custom CSS without creating a full child theme, WordPress also has a built-in Additional CSS section in the Customizer. This is useful for quick tweaks but does not persist if you switch themes.
For complex changes — such as adding new post types, custom fields, or significant functionality — a child theme is the foundation, but you may also need a custom plugin to keep your code organized and portable across different themes.
Frequently Asked Questions
Do I need to know code to create a child theme?
You need to understand basic file structure and be comfortable copying and pasting code, but you do not need to write code from scratch. The functions.php code is the same for every child theme — you only change the theme name. CSS is easier to learn than PHP, and you can find examples online for most common changes.
What happens if I update the parent theme after creating a child theme?
The parent theme updates normally, and your child theme's files remain untouched. Your customizations stay in place. This is the entire reason to use a child theme — updates do not erase your work.
Can I create a child theme of a child theme?
Technically yes, but it is not recommended. A grandchild theme adds unnecessary complexity and makes debugging harder. If you need multiple layers of customization, use a single child theme and organize your code within it.
How do I know the exact name of my parent theme's folder?
Log in to your hosting control panel's file manager, navigate to /wp-content/themes, and look at the folder names. The parent theme folder name is what goes in the Template line of your child theme's style.css, in lowercase with no spaces.
Can I delete the parent theme after activating the child theme?
No. The child theme depends on the parent theme's files to function. If you delete the parent, the child will not work. Keep the parent theme installed even though you are not using it directly.