Post at a Glance
5 Simple Step By Step Directions for Creating Your WordPress Child Theme
If youโre like me you like to update and tweak your WordPress template with great frequency. By creating a WordPress Child Theme youโll never lose these updates again.
While itโs great to be able to update your theme to add functionality and additional theming it becomes taxing if you update your template. Updating your template is important to do as new security features, bug fixes and usability updates become available. It makes sense to keep your files current, but then what happens to all those in-line code tweaks youโve added?
The solution to this is to create a WordPress child theme. A WordPress child theme allows you to continue to update your theme files while not over writing your code updates. Creating a WordPress child theme is pretty easy to do and will save you countless hours of re-coding every time thereโs a new update for your theme file.
How to set up a WordPress Child Theme
To create your first WordPress child theme youโll need to create a folder with the same name of the โParentโ theme you want the child to append. In this example Iโll create a folder called โtwentytwentyfive-childโ. Youโll need to start by creating 2 files styles.css and functions.php.
This is assuming your using a style-sheet called style.css. If yours is called something different youโll have to rename it appropriately. The following paragraph outlines the new code youโll need to add to your CSS in order to define and call your new child-theme.
Step 1 Create your WordPress Child Theme folder
Like I stated above create a theme folder with the following naming convention โtwentytwentyfive-childโ. This is the folder where you will upload style.css, functions.php and any other file you wish to alter that lives in your parent theme. This file should be added to the same folder as the parent theme.
WordPress Child Theme CSS Anatomy Explained
Itโs brilliantly simple to create your own WordPress child theme and really takes very little time depending on how many files you wish to update. Youโll have to add this first bit of code to get started. Iโll outline what it is your changing and what lines of code you need to update to reflect your own theme. In this example Iโll be using the default WordPress 2025 theme.
An explanation of what youโre defining follows.
<strong>Theme Name:</strong> Twenty Twentyfive
<strong>Theme URI:</strong> https://wordpress.org/themes/twentytwnetyfive-child/
<strong>Description:</strong> Twenty Twentyfive Child Theme
<strong>Author:</strong> Your Name
<strong>Author URI:</strong>
<strong>Template:</strong> twentytwentyfive
<strong>Version:</strong> 1.0.0
<strong>License:</strong> GNU General Public License v2 or later
<strong>License URI:</strong> http://www.gnu.org/licenses/gpl-2.0.html
<strong>Tags:</strong> add optional description tags
<strong>Text Domain:</strong> twentytwentyfive-childStep 2 create your style.css
Add the code above to the beginning of our styles.css. Additional styles can be added to this style-sheet after the code below.
Theme Name: Twenty Twentyfive
1. This is the title that will show up in your theme description.
Theme URI: https://wordpress.org/themes/twentytwentyfive-child/
Link to your themeโs page.
Description: Twenty Twentyfive Child Theme
2. How your description will read.
Author: Your Name
3. This can be your own name or the name of your design/ development team.
Author URI:
4. This can be a link to your homepage or one that links to more information about your theme if you plan to distribute it.
Template: twentytwentyfive
This piece is important. This should be the exact name of the file your theme lives in your content folder. Itโs what is used to reference your child theme so keep it case sensitive.
Version: 1.0.0
5. Theme version shows up in the description.
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Licensing information optional.
Tags: add optional description tags
6. Itโs a good idea to add tags if you plan on distributing your theme otherwise this isnโt necessary to create a child theme.
Text Domain: twentytwentyfive-child
Defines the name of the child theme
Step 3 create your WordPress Child Theme functions.php file
The next step is to create your funtions.php file. This file calls your child-theme and loads it along with the rest of your page to call your new updates.
Make sure you add โ-styleโ to the end of line 3 below. It should read as follows:
$parent_style = โtwentytwentyfive-styleโ;
<?php
function my_theme_enqueue_styles() {
$parent_style = 'twentytwentyfive-style'; /
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 ),
wp_get_theme()->get('Version')
);
}
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
?>Step 4 Activate your child theme
Once youโve created style.css & functions.php and uploaded them to the child theme folder you created earlier youโll need to activate your new child theme.
Go to Appearance > Themes and you will see your new child theme awaiting activation. Click to activate it and your ready to start utilizing the benefits. To add bigger code changes effecting pieces of your site follow directions in the last step below.
Step 5 Add Updated files to your WordPress child theme folder
Considering you want to do more than just style your theme you probably want to add existing functionality to your posts or pages. For example I added updates to my single.php file to add banners and functionality to my post pages.
All you need to do is download the file you donโt want to change when you update your theme. In our example Iโll be pulling footer.php from the twentytwentyfive parent folder. Once youโve added your new code to this file youโll want to upload it to the child theme folder. To make changes to different parts of your site simply download and alter files from your parent folder and upload them to the child theme folder.
From here on out you can freely update your template files any time thereโs a new update while not effecting code changes that live in your child folder. Hope this post helps shed some light.
Happy blogging pixel pushers.
REQUEST WORDPRESS DEVELOPMENT
Do you have a WordPress or would you like one? Fill out this short form and we’ll contact you to talk about your WordPress project needs.
Related Posts:















