How to set up smartphones and PCs. Informational portal
  • home
  • Windows 8
  • What is a child theme in WordPress? Pros, cons, and more. How to Create a WordPress Child Theme

What is a child theme in WordPress? Pros, cons, and more. How to Create a WordPress Child Theme

A child theme is a theme that inherits the functionality and design of another theme, called the "parent" theme. A child theme is a way recommended by the WP developers to modify an existing theme for themselves.

Why use a child theme?

There are several reasons why you would want to use a child theme:

  • If you change the theme directly and it gets updated, your changes will simply be lost. By using a child theme, you will be sure that your changes will be saved.
  • Using a child theme can speed up development time.
  • Using a child theme is a good way to learn the WordPress theme development process.

How to make a WordPress child theme

A child theme consists of at least one folder (child theme directory) and two files (style.css and functions.php) that you will need to create. So, you will need:

  • Child theme directory
  • style.css
  • functions.php

The first step is to create a directory for the child theme, which will be placed in the wp-content/themes folder. It is recommended that the name of the child theme directory end with the “ -child ” suffix (although not required, especially if you are creating a theme for public use).

You also need to make sure that there are no spaces in the child theme directory name, otherwise it will throw an error. In the screenshot above, the name of our child theme is “ twentyfifteen-child ”, meaning that the parent theme is Twenty Fifteen.

The next step is to create a stylesheet for the child theme (style.css). The style file must begin with the following meta information:

/* Theme Name: Twenty Fifteen Child Theme URI: http://example.com/twenty-fifteen-child/ Description: Twenty Fifteen Child Theme Author: John Doe Author URI: http://example.com Template: twentyfifteen Version: 1.0.0 License: GNU General Public License v2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready Text Domain: twenty-fifteen-child */

Theme Name: Twenty Fifteen Child

Theme URI: http://example.com/twenty-fifteen-child/

Description: Twenty Fifteen Child Theme

Author URI: http://example.com

Template: twenty-fifty

Version: 1.0.0

License: GNU General Public License v2 or later

License URI: http://www.gnu.org/licenses/gpl-2.0.html

Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready

Text Domain: twenty-fifteen-child

Important information you should be aware of:

  • You will need to change the text of this example based on your situation.
  • The string “ Template ” corresponds to the name of the parent theme directory. In our example, the parent theme is Twenty Fifteen, so the string “ Template ” contains “ twentyfifteen ”. There may be a different topic in your case, so adjust accordingly.
  • In principle, the style file (style.css) is already enough to create a child theme. However, in order to correctly queue up styles to load, you will need a functions.php file (see below).

The third and final step is queuing the parent and child style files.

Note that the previous method involved importing parent styles using the @import directive. This is now an outdated practice.

How to correctly and correctly load styles

The correct method of queuing the parent stylesheet is to add hook(or, in English, action) as a wp_enqueue_scripts function.

This method also involves using the wp_enqueue_style() function in the child functions.php file. So you need to create this file in your child theme directory.

The first line of the child functions.php file starts with the opening PHP tag (

The following function example will work if the parent theme has only one main style.css file containing all the CSS rules. If your theme has more than one .css file (including ie.css , style.css , main.css ) then you will need to satisfy all required parent theme dependencies.

add_action("wp_enqueue_scripts", "theme_enqueue_styles"); function theme_enqueue_styles() ( wp_enqueue_style("parent-style", get_template_directory_uri() . "/style.css"); )

Typically, a child theme's stylesheet is loaded automatically. If it's not, you'll also need to enqueue it. By setting parent-style as a dependency, make sure the child theme's styles are loaded after it.

add_action("wp_enqueue_scripts", "theme_enqueue_styles"); function 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" , "theme_enqueue_styles" ) ;

function 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" )

Your child theme is now ready to be activated. Log in to the admin panel, then go to the page Appearance > Themes. You should see your child theme in the theme list and ready to be activated. (If your current installation has multisite enabled, then you need to switch to the appropriate panel to enable the theme. After that, switch back and activate the theme).

Important: After activation, you will need to re-save your menu ( Appearance > Menu or Appearance > Tune> Menu) and theme options, including a background image as well as a header image, if provided by the parent theme.

Template files

If you want to change more than the styles, there is a way to override any parent theme files. To do this, simply include a file with the same name in your child theme folder. Thus, it will “override” the corresponding file in the parent theme directory when the site loads.

For example, if you want to change the header PHP code, you can include a header.php file in your child theme directory and that file will be used instead of the parent theme's header.php.

You can also include files in a child theme that weren't originally in the parent theme. For example, you can create a more functional template than the parent template for a particular page or category.

Using functions.php

Unlike style.css , a child theme's functions.php file does not override the parent's copy. On the contrary, it is, as it were, an addition to it (more precisely, it is loaded front parent copy).

Thus, a child theme's functions.php provides a smart, hassle-free way to change the parent theme's functionality. Let's say you want to add a PHP function to your theme. The fastest way is to open the theme's functions.php file and put the function there. But this is not very smart: the next time the theme is updated, your function will simply disappear.

There is an alternative path that is more reasonable: you can create a child theme, add a functions.php file to it, and put your function in the newly created file. The function will do the same job from there as well, with the advantage that it won't suffer from future updates to the parent theme. Hence an important note: do not copy the entire contents of the parent functions.php file into the same child file.

The structure of functions.php is simple: the opening PHP tag at the beginning, and below it you place your PHP code. You can place as much code as you need in this file. The example below illustrates a rudimentary functions.php file that does one simple thing: add a favicon link to the tag HTML pages.

" . "\n"; ) add_action("wp_head", "favicon_link");

Tip for theme developers: The fact that a child theme's functions.php is loaded first means that you can make user functions replace developer functions, i.e. if the user created the same function as yours, then it will become the main one. Just add a condition:

if (! function_exists("theme_special_nav")) ( function theme_special_nav() ( // Do something. ) )

In this case, the child theme can replace the parent's PHP function by simply declaring it ahead of time.

Including files in your child theme

When you need to include a file that should be part of the child theme structure, use the get_stylesheet_directory() function. Since the parent stylesheet file style.css is replaced by the child style.css , and the child style.css is located in the root folder of the child theme's subdirectory, get_stylesheet_directory() will point to the child theme directory, not the parent theme directory.

Below is an example of using the require_once construct that illustrates how you can use get_stylesheet_directory when you need to refer to a file stored in a child theme structure.

require_once(get_stylesheet_directory() . "/my_included_file.php");

require_once (get_stylesheet_directory () . "/my_included_file.php" ) ;

Additional useful information

Using post formats

A child theme inherits the post formats defined in the parent theme. When creating a child theme, be aware that using add_theme_support("post-formats") will override the formats defined in the parent theme, not add to them.

RTL support (right-to-left writing)

To support RTL languages, add the rtl.css file to your child theme. It contains:

/* Theme Name: Twenty Fourteen Child Template: twentyfourteen */

A WordPress child theme is a theme that extends the functionality of another theme, called a parent theme, and allows you to modify or add functionality to the parent theme. This article explains how to create a simple child theme and what you can do with it. An example of a parent theme is Twenty Ten, the new default theme in .

Attention! If the information below seems difficult for you to understand, then you can use a more up-to-date and faster way to create a child theme using the Child Theme Configurator plugin

Creating a child theme is very easy. Create a folder, put the appropriately written file in it style.css and the child theme is ready! With a little understanding of HTML and , you can change this very simple child theme- changing the appearance and layout of the parent theme, but not changing its files. This way, when the parent theme is updated, your changes are saved.

Child themes in WordPress allow you to make changes to existing themes, and in such a way that such changes are not lost when updating the original (or parent) theme. In addition to appearance, child themes allow you to change the layout, and even the functionality of the parent theme, extending it to your own needs.

Support for child themes in WordPress has been around for a long time, but most users today still prefer to make changes to the source theme code directly. In this article, we will explain how child themes work in WordPress and why child themes should be used to make any changes to existing themes.

What is a child theme

A child theme in WordPress is a theme that inherits the look and feel of a parent (original) theme. Such inheritance makes it easy to change and supplement certain parts of the parent theme without changing the original theme itself. With this approach, updating the parent theme will not affect such changes.

The parent theme can be any other WordPress theme (with the exception of child themes), and for the child theme to work, both themes must be installed, but the child must be activated.

How to create a child theme

The simplest child theme consists of a single style.css file that specifies the name of the child theme and the name of the parent theme directory. The same file often references the parent theme's stylesheet using the @import CSS directive.

As an example, we will create a child theme called My Child Theme and use the default Twenty Twelve theme as the parent theme.

First, make sure the parent theme exists - find the twentytwelve directory in wp-content/themes . Then create a new directory in wp-content/themes and name it my-child-theme . In this new directory, create a style.css file and paste the following heading into it:

/** * Theme Name: My Child Theme * Template: twentytwelve */ @import url("../twentytwelve/style.css");

With the help of this title, we determined the name of our new theme, and also indicated the parent. The @import directive in this case loads all the styles from the Twenty Twelve theme, on top of which we will make our changes. Without this directive, our child theme will only inherit the templates (markup) of the parent theme, not the style.

After that, your theme directory should look something like this:

When you go to Appearance → Themes, you will see that your new theme is already available for activation.

If you activate it and navigate to your homepage, you will see that your child theme looks exactly like the default Twenty Twelve theme.

Working with styles

Child theme CSS styles can be set directly in the style.css file right after the @import directive. For example, to set the background and link colors in your theme, add the following code to the end of your stylesheet:

Body ( background: red; ) a ( color: green; )

In this way, you can change the styles of any elements of the parent theme, and you can easily find the necessary element using the developer tools in the Google Chrome browser or using the Firebug extension for the Firefox browser.

Working with Templates

With the help of a child theme, you can also easily modify the templates of the parent theme itself. To do this, just create a file in the child theme with the same name as the template in the parent theme. For example, to replace the footer.php template with your own, create a footer.php file in your child theme directory:

Footer text

So we've replaced the text in the footer of the Twenty Twelve theme with our own.

Often when working with templates in child themes, it's easier to copy an existing template from a parent theme and make changes to it in the child theme, thus maintaining the structure of the entire HTML document. If you make a mistake, you can always delete the template and start over.

You can also create new template files that are not in the parent theme and WordPress will include them according to the template hierarchy. For example, if the page.php file is missing in the parent theme, you can create a file with this name in your child theme and WordPress will include it when rendering any page.

It is also worth noting that not all files of the parent theme can be changed in this way. For example, you won't be able to modify a file that was called by a PHP include or require function.

Working with functions.php

If you have any questions about making changes to existing WordPress themes, leave a comment and we will definitely answer you.

Friends, hello everyone. I am glad to welcome you to my blog. And today I want to talk about creating a WordPress child theme. To date, this is the most optimal approach when creating a site on the WP platform.

As you know, in order to create a website, you need to follow certain steps. And one of these steps is choosing a theme for your website or blog. There are a lot of topics, and when choosing, you must first of all be guided by technical characteristics (validity of the code, download speed, mobility, cross-browser compatibility, etc.). And the design can always be modified to suit the needs of a particular project.

What is a WordPress Child Theme

But, if the theme is regularly updated, then all the changes you made will be reset to the basic settings.

So, a child theme is a 100% copy of the parent theme (the main theme). All changes made in the child theme will be reflected in the parent theme. However, the files of the parent theme will not change. And the theme will be updated with your changes.

How to Create a WordPress Child Theme

First you need to understand the folder structure on your site. That is, by creating a site on the WordPress platform, the themes folder will appear on the server, which contains the folders of all the themes installed by default and by you.

It is in the themes folder, next to the parent theme, that you will need to create a new folder with a child theme.

We connect to the server. Through or through the hosting file manager, it's up to you.

Open folders one by one:

folder with your site

parent theme folder

Create a child theme folder next to the parent theme folder. The name doesn't matter. In a sense, you can assign any name with English characters.

Create a file in your child theme folder style.css. This is a required file. It is he who will be responsible for the interaction of the parent and child themes.

Customizing the style.css file of a WordPress child theme

File style.css in a child theme should contain information about the parent theme. From it, WordPress will understand between which topics the interaction is organized.

Also, the style.css file in the child theme replaces the same file in the parent theme. And therefore it is necessary to include styles from the parent theme.

So let's get started.

Open the style.css file (I usually create this file on my computer with Notepad++ and then copy it to my hosting child theme folder).

Paste this code into the style.css file:

/* Theme Name: Topic title (in English characters) Theme URI: theme url Description: Description of the theme Author URI: url of your site or page about the author template: parent theme name (case sensitive) version: 1.0.0 */

Here is an example of what this code looks like in my new theme.

Please note that the required fields are Theme Name and Template . The rest of the fields you fill in at your discretion.

Now we need to organize the import of styles from the parent theme. The fact is that once the style.css file appears in the child theme, WP does not load the same file from the parent theme. And as a result, without styles, your theme will look terrible.

To include styles from the parent theme, you need to write just one line of code:

@import url("../ parent theme folder/style.css");

As you understand, this is a conditional path to the style file in the parent theme. You can also specify the full (absolute) path to the parent theme's stylesheet.

But after connecting the styles, you can add your own design styles. Please note that it is after, that all your additional styles must come after the import line.

But in order to see all the new changes, you need to open the WordPress admin panel and activate the child theme.

What files can be stored in a child theme folder

In this folder, you can store at least all the files of the parent theme. But, this is not at all necessary. Keep only those with which you will work. Where you will make changes. Let's look at a few examples.

Theme function file functions.php

If you store this file in a child theme, it will be loaded in addition to the parent theme's main file. Thus, this file will contain only your improvements in terms of functionality.

Moreover, you should understand that all changes made to the files of the child theme are not only improvements, but also changes in the functions and design of the parent theme.

Let's say, in my current topic, I constantly had a problem with the fact that the headings H1 and H2 were confused. I have provided a solution to this problem in . And in my new theme, I can implement this through the functions.php file. By adding just this code:

Add_filter("tc_site_title_tag", "change_tag"); function change_tag() ( if (!is_single () && !is_page ()) return "h1"; if (is_single () || is_page ()) return "p"; )

And all because my new theme is completely built on WordPress API keys.

Main theme (template) files

After activating a child theme in the admin panel, you won't be able to edit the main theme files (single.php, page.php, index.php...). Because they just won't be there.

In order for them to be displayed in the admin panel, you just need to copy the files from the parent folder to the child.

You need to copy the file exactly to the same place where they are in the parent folder. That is, so that the path to the file differs only in the name of the parent and child folders.

After copying the necessary files, they can be edited through the WP admin panel.

And according to the same scheme, copy other files, and edit it in the child theme. Parent theme files will remain unchanged. And then everything is in your hands.

And now we are watching a video tutorial and you can start creating child themes.

That's all, dear friends, the simple algorithm for creating child themes in WordPress is finished. Try, implement, and create your own themes. I just want to draw your attention to the fact that it is best to create a child theme immediately after setting the parent theme. Otherwise, if you have already tinkered with the parent theme, then your child theme will not be 100% implemented, and it may get crooked.

So, you decided to work on a new theme, chose, created a child theme and work with it.

That's all for today, see you in new video tutorials and articles. And of course, if you have any questions, write in the comments, I will be happy to help. I wish you good luck and good mood!

Subscribe to new articles!

71 comments to Article " How to Create a WordPress Child Theme

  • Basil

    A very interesting topic. Several questions immediately arose.

    1. Maxim, does the use of a child theme somehow affect the site loading speed?

    2. I use a special Function.php plugin to insert code into theme files. If you additionally use another child theme, for example, for microdata. Is it possible?

    3. If you copy all the files from the parent theme, then nothing will change after updating the theme. But the author can remove something from there. We only need to keep certain lines of code and let the rest of the changes happen. Is it possible?

    • Vasya, hello. A child theme really pushes the boundaries of customizing the theme to fit your needs.
      1. The child theme does not affect the loading speed. It all depends on the parent theme itself and on the code that we insert into the child theme. If all the improvements are valid, then the download speed will be at its best. I tested on GTmetrix and Pingdom. The main thing is that the parent theme should be smart.
      2. Theme functions in a child theme are, in fact, all our improvements collected in the Function.php plugin. So, you can freely use the plugin and not go into the theme function file. Well, accordingly, all micro-markup must be created in a child theme.
      3. All files do not need to be copied. Only those in which we make changes. This keeps the parent theme files in the original. Files are updated with our improvements. I already checked.

  • Sergei Steklov

    For some reason, when I update the Customizr theme, my child theme crashes. And all because of the edited files that are in the inc -> parts folder. Namely:
    class-content-featured_pages
    class-content-post_navigation
    class-content-slider
    class-footer-footer_main
    class-header-header_main
    When I delete these files, the child theme with the updated parent works fine. But now Customizr 3.3.26 works fine with my child. As soon as I start updating the parent, the child flies. It turns out that the above files cannot be edited at all, since old copies of the files may not work with the new version of the theme. I don't remember exactly what I changed. But it seems like he definitely removed the link to the developer in the footer, edited the slider and something else. The theme is not Pro, that is, the free version is used.

  • Natalia

    I am making a second site on WP, using ready-made templates. The second site is still in Denver, WordPress with the Storefront theme. The theme itself is designed for an online store, it integrates with the WooCommerce store plugin. The problem is that Storefront is already a child theme of Twenty Ten. Question: how to be in this case - to create a child theme from a child? Or leave everything as it is? And what happens if you simply DO NOT UPDATE THE THEME while the site is running? What could be the consequences (without updates)? And the second question: if you do not update the theme, but regularly update the store engine (WooCommerce), will there be any fatal conflicts in the future? Thank you in advance for your response!

  • Tata

    Thanks for the detailed and clear information on child themes. Did everything as written. I updated both the engine and the theme - everything works except for the wppage plugin. Now the pages made with it are displayed as normal pages with the sidebar of the installed theme. I suppose you need to write template_include somewhere for wppage pages. But my knowledge is clearly lacking. Can you help me Max?

  • Larisa

    Maxim, and me again. I started creating child themes for websites and the question arose: are there any themes that do not support the creation of child themes? I have a theme on a test domain where I can't activate the child one. The site crashes and gives a 500 error. What can be wrong? I tried to transfer one style.css file and all folders and files of the parent theme (except the parent style sheet) to the folder with the child theme, all the same, when activating the error and pulling the site out of the backup…

    • Larisa, this happens when a child theme has a path to a folder or file that is not in the parent theme. You need to try to create only a style file in a child theme without folders and other files. When the theme is connected, it is already possible to gradually transfer the necessary files and in the end it will be clear what is disrupting the site.
      In such cases, I work through an ftp connection, copy the file and check the work. If the site stopped working, then the reason is in this file. I delete it - the site starts working. And I find out the reason that it is not so.

      • Larisa

        Thanks for the idea! I did this: I created a folder with a child theme and a style.css file. I activated a child theme from the admin panel and got a site devoid of styles. Sometimes this picture happens with a slow Internet connection. I got such sites on LAN while mastering html)))))))))) There are a lot of settings and widgets in the theme. There is a special field for creating your own styles. I tried to copy the entire CSS of the parent theme into this field, I got some kind of mess from the widgets (the basement ones “got on” to the header widgets) ... I don’t understand why the styles are not connected humanly ... By the way, there are two functions files in this theme ... One of them lies in an additional folder with its name.

  • Larisa

    Maxim, the VP code says that you can create a functions.php file in a child theme, which will be loaded in addition to the parent one. You can write directives in it that will override directives from the parent theme. Plus write your directives. The styles of the parent theme did not connect for me through import in the css file. I had to do this through the child functions.php file. Transliterated through the same file. The site is in working order. But! I couldn't override the copyright function in the footer of the site (there is a link to the developer and wordpress).

    • Larisa

      Removed all unnecessary copyrights, but not through redefinition, but simply added a piece of code from the parent theme function and removed the conditions by which links appear from there. So far, everything is working, but the site has not been set up yet, it is in a classic, original state.

    • Larisa, yes, it is through the functions.php file of the child theme that all changes are made and they do not crash when the parent theme is updated. But, it works well on modern themes, where everything is tied to the API.
      With copyright, if you can’t change it separately, then you need to change the entire block above. Or you can copy the footer file into a child theme and change the copyright. So much easier. 😉

  • Natalia

    Yes, sorry I missed it. Found your post too late.
    I made a blog for my husband, and every time he updates the theme, the picture in the header and information in the footer disappear. Every time after the update you have to adjust all this. Fortunately, I have all this saved in Evernote and I don’t have to spend a lot of time on it. But it's stressful.
    Now, if I have to create new sites, I will immediately make a child theme.
    Thanks for the detailed tutorial. Alexander

    Hello Maxim!
    When inserting modified files with micro-markup, problems arise. I already told you that I don't really know a programming language. Here, for example, when inserting the sidebar-left and sidebar-right files with revision, you did not specify how to correctly enclose them in tags, and only the header remains on the site. Again, when you insert a class-content-page with micro-markup according to your lessons, the right side-bar in the pages flies under the left one. And about functions, I didn’t find anything understandable at all anywhere - when it is inserted in any form (original or modified from micro-markup lessons), the site becomes unavailable. But it is he, as I understand it, that is one of the main elements for the correct functioning of the child theme. The rest of the files become normal, only Yashka swears at the basement (google is not): WARNING: the value "© 2016" in the copyrightYear field is not a valid number value. The output of articles is not configured from the main one, so, you understand, when editing, I had to look for other line numbers. Displaying announcements is also different. I don’t show category, date, and author tags — a lot of URLs with errors appear in the Search Console. In general, I google, google, and in the end I get to you again. If you can give me some advice, I'd be grateful!

    And this causes some inconvenience. For example, the topic is not translated into Russian. There is only one nepalbuzz.pot file in the languages ​​folder. Let's say the word "Search ..." is displayed in the search box. I want to change it to "Search ..." In the nepalbuzz.pot file I find this line, it refers to the inc/default-options.php file. There, too, I find such a line.
    But changing files in the parent theme is not recommended.
    I already have a child theme nepalbuzz-child. In style.css everything is specified as it should be.
    And now I want to change the default-options.php file copied to the nepalbuzz-child/inc folder. But in order for the change to take effect, I will have to copy core.php there as well and reference it in function.php.
    But this core.php contains links to other files in the parent theme and they are not in nepalbuzz-child. Do I have to redirect them all to the parent theme?
    In short, there is confusion with references.
    And if you simply, without further ado, copy ALL the contents of the parent theme to the child? Will there be any problems? Will the files change when the theme is updated? And is it necessary to specify the parent theme in style.css?

  • Olga

    Hello! Tell me, please, if I have already made changes to the Parent theme and want to update it, then when creating the Child theme, what files do I need to move from Rt to Dt so that my previously made changes in the Parent theme are not lost during the update?
    And one more question:
    - after installing the Child theme, the site will be displayed with a new child url?

Many of our users ask us what template do we use? Our answer is that we use a non-standard secondary theme built on the framework. The follow-up question is most of the time in two parts. What's happened ? The second part of the question is what is a WordPress secondary theme? We have already explained what a WordPress framework is in our previous articles. In this article, we will do our best to answer questions like what is a WordPress secondary theme, when should you create a child theme, why do people create child themes, and finally the advantages and disadvantages of using a child theme. We hope that after reading this article, you will have a clear understanding of what a child theme is in WordPress and you will know whether you should use a child theme or not.

What is a WordPress Child Theme

This is a theme that inherits functionality from another WordPress theme, the parent theme. Child themes are often used when you want to tweak or tweak an existing WordPress theme without losing the ability to update that theme. In the past, there was no easy way to update a WordPress theme without losing all user preferences and changes you have made. It turns into chaos when all of a sudden you see a widely used script in a popular theme that has a lot of features and you need to update your theme as soon as possible. This becomes a difficult choice, because on the one hand, you will lose all custom styles when you update. On the other hand, you risk getting your site hacked if you don't update fast enough.

The WordPress community decided to solve this problem by introducing the concept of a parent theme and a child theme. A child theme in WordPress will inherit all the functionality, features, and code of the parent theme without making any changes to the parent theme. This allowed users to change the parent theme's styles and add/change features without losing the ability to update the parent theme.

In theory, any WordPress theme can have child themes, however, not all WordPress themes have good parent themes. A parent theme with limited functionality and features is not an ideal parent theme candidate in most cases. We will talk about exceptions, see later in the article.

Good parent themes, also known as frameworks, usually contain their own hooks and filters. This allows designers and developers to build robust custom WordPress sites with a child theme in no time.

Why do people use WordPress child themes?

Designers and developers use child themes to speed up their development. By using a good parent theme, you can significantly reduce the time it takes you to create a WordPress site. All good parent framework themes offer a lot of functionality and customization so you don't have to code everything. Users often create child themes to tweak an existing theme without losing the ability to update the parent theme if necessary.

Creating a child theme in WordPress can be as simple as creating a new style.css file in a new folder. All you really need is one line in your new style.css for the header, which defines the template. A reliable parent theme can have as many template files as the parent theme, if not more. A child theme can have template files that are not even available in the parent theme.

When do you use a child theme?

The decision to use a child theme often depends on your needs. Most of the sites that we will build for ourselves and our clients are child themes with a framework. On the rare occasions when a project is too complex or too simple, we build it as a standalone custom WordPress theme. As WordPress developers, we need to streamline our workflow when creating a quality theme. Creating a child theme from existing frames helps us achieve all of this.

For users, we only recommend child themes if you find yourself constantly adding new features for your theme to your theme's functions.php file and/or constantly adding/changing your theme's style.css file. In these cases, we highly recommend using a child theme. Some time ago during our meeting we were talking about WordPress, one of the members asked us what if we only add custom styles? Is it better to use a child theme or custom CSS plugins?

The answer depends on how savvy and comfortable you are with technology. If you're only changing styles for a few elements with custom CSS plugins, it works just fine. However, if you will be changing the entire color scheme, changing in CSS, etc., then you should definitely consider using a child theme.

Choosing a Good Parent Theme is Important

All WordPress themes are within a parent theme, but not all parent themes contain frameworks. We cannot emphasize this exactly. While any WordPress theme can have child themes, not all of them are meant to be used as frameworks. We've seen numerous newbies make the mistake of creating a child theme from a parent theme that doesn't offer much functionality.

When creating a child theme where you are forced to replace large parent theme files, then you need to rethink your process. For example, you really like twenty eleven theme and decide to create a child theme. In your child theme, you had a style.css file, and a functions.php file. You decided you didn't like the way the footer looked, so you added footer.php. For the title, etc. If so, then you shouldn't choose twenty-eleven as the parent theme. Rather, you should use it as a theme starter that you include in your own themes.

We've had a few users create custom child themes, which really should be completely independent custom themes because almost all of the parent theme's files have been overridden in them.

In short, you should use a child theme when you need the functionality, features, and power of the parent theme without having to write a lot of code for yourself.

Benefits of using a child theme

As with most things, there are advantages and disadvantages to using a child theme in WordPress. Let's take a look at the benefits of the former.

1. Safe Updates
A child theme automatically inherits the features, styles, and templates of the parent theme. This allows you to make changes to your site using a child theme without any change to the parent theme. When a new version of the parent theme appears, you can safely update it as all your changes will be saved in the child theme.

2. Easy to expand

A child theme is built on a powerful framework allowing for great flexibility without having to write a lot of code. You can selectively modify only the template files and functions you need, bypassing other template files. You can add new features and more.

3. Backup Safe

When creating a complete theme when you have to think about all possible scenarios and code for them. However, when you're working on a child theme and you forget the code for something, there's always a parent theme whose functionality is available as a fallback.

Disadvantages of using a child theme

One of the biggest disadvantages of using a child theme is the time it takes to learn about the parent theme. There is a learning curve, especially when you work with a solid foundation because each one has its own hooks and filters. You really need to know the ones to maximize the potential. In our opinion, this learning curve is a one-time thing. For example, the first few child themes you create may take longer, but after that, you'll be building bespoke sites in the same amount of time. Your performance will improve.

Another drawback has often been pointed out is that the developers of your parent theme might lose interest and abandon it, drop a feature you used in your child theme, or bring in a change that completely breaks your child theme. It's not as bad as it seems. Mainly because all good WordPress themes are open source and GPL. If the developer of the parent theme leaves the project, then nothing says that you should stop using it. There are often times when other people work on a project one after the other. If a developer removes a certain feature from the original theme, then you can simply add it to your child theme. You have a code for it. Finally, if they make drastic changes that you don't like, then you can always avoid the upgrade. The update theme is critical when it is safe to operate. We always encourage users to update themes because it helps ensure future compatibility with other scripts and plugins.

If you are using a commercial framework as your base then you have a support option available to help you update your theme or troubleshoot. Also, the Platform as a basis will not just disappear, because there is a stable business of the company with thousands of customers around the world. For example, they have removed some built-in widgets, but they have made them publicly available as plugins for those who still want to use it.

Output

It is important to know that although you can always create to any theme, sometimes you may not need a child theme. Think about the amount of changes you have planned for your child theme, if you are planning on minor changes then you can always create a custom style file in your theme's CSS or use custom CSS plugins. If the changes are too extreme, where you end up overriding the parent theme's core files, then you should probably create your own theme.

We hope this article will help you understand what a parent theme is in WordPress and whether it is right for you or not. If you think we missed something, then please let us know in the comments below.

Top Related Articles

Categories: