
We are often approached by clients that already did their research for their website project and found a WordPress themeTheme A collection of files that determine a site's design, ... More that they like, but that would need a bit of customization to perfectly fit their needs.
As you already know if you are familiar with WordPress, a themeTheme A collection of files that determine a site's design, ... More is the templateTemplate A file in a theme that defines how different parts ... More that is used to render your website’s look-and-feel. There are plenty of themes available for free on the WordPress.org theme directory, but also some premium ones that come with a price. In the case of premium themes, they are always built by agencies and ensure that your website will look professional. However, they may not fit your needs 100% in terms of design and functionalities.
Luckily, WordPress offers you the possibility to create child themes, which were built just for that purpose.
A child themeA theme that inherits functionality and styling from a paren... More is a sub-theme that will inherit all the functionalities and looks of a parent themeTheme A collection of files that determine a site's design, ... More (aka a regular themeTheme A collection of files that determine a site's design, ... More). This allows you to make changes to the visual appearance or functionalities of you website, while leaving the parent themeTheme A collection of files that determine a site's design, ... More untouched, because all the changes are kept separate in the child themeA theme that inherits functionality and styling from a paren... More files.
The main benefit of creating a child themeA theme that inherits functionality and styling from a paren... More is that it will greatly improve the maintainability of your website. In fact, changes made to your child themeA theme that inherits functionality and styling from a paren... More will not be affected by the updates you do on the parent themeTheme A collection of files that determine a site's design, ... More. Being able to do all updates of your themeTheme A collection of files that determine a site's design, ... More quickly is important, as it makes your website more secure and it gives you access to all the new functionalities that come with the themeTheme A collection of files that determine a site's design, ... More.
WARNING: this section assumes that you are already comfortable with the structure of your WordPress site, themes in particular, and that you know how to use FTP or SSH to create, delete, and update directories in WordPress.
Creating a child themeA theme that inherits functionality and styling from a paren... More in WordPress is quite straightforward. It only takes the following steps:
Inside your WordPress installation’s themeTheme A collection of files that determine a site's design, ... More directory, create the child themeA theme that inherits functionality and styling from a paren... More folder as you would for a regular themeTheme A collection of files that determine a site's design, ... More.
To detect your themeTheme A collection of files that determine a site's design, ... More, WordPress uses the stylesheet’s headers. You should create a stylesheet named style.css (it will not work if you name it otherwise) and include the required headers in it. The headers of the stylesheet should look like something like this:
/*
ThemeTheme A collection of files that determine a site's design, ... More Name: Twenty Twenty-Two Child theme
TemplateTemplate A file in a theme that defines how different parts ... More: twentytwentytwo
Author URI: https://wordpress.org/
Description: Built on a solidly designed foundation, Twenty Twenty-Two...
*/The important parts are highlighted in bold above, they are the themeTheme A collection of files that determine a site's design, ... More name (child theme’s name) and the templateTemplate A file in a theme that defines how different parts ... More (parent themeTheme A collection of files that determine a site's design, ... More name).
This little bit of code is added to your child theme’s functions.php file to ensure that the styles of both the parent and child themeA theme that inherits functionality and styling from a paren... More are loaded, and that they are loaded in the right order.
<?php
add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );
function enqueue_parent_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
}
?>Once all these things are done, you are ready to install your themeTheme A collection of files that determine a site's design, ... More and activate it.
Once you are ready and that your child themeA theme that inherits functionality and styling from a paren... More is installed, you can start working on it. This will obvioulsy require some development skills. In short, you will be able to change most of the colors and visual elements by customizing the styles in the stylesheet, while the more functional changes will happen in the functions.php file.