WordPress Child Themes – when & how to use them

Last Updated:
Gavern Framework

GavernWP v.1.6+ provides full support for the Child Themes mechanism, which allow you to easily modify the theme. A WordPress child theme is a theme that inherits the functionality of the parent theme, and allows you to selectively modify the layout, styling, and functionality of the parent theme.

Advantage of using a child theme is to protect any customizations you make inside WP from being overwritten if a newer version of the theme comes out. That’s why this is the safest and easiest way to modify an existing theme. This is important because changes to the default theme may be more frequent than regular themes due to the need to add more hooks or functions over time.

When use a Child Theme?

There are several reasons to use child themes:

  1. You don’t have to worry about any updates. With a child theme, you can update the parent theme (which might be important for functionality) and still keep your changes, because code in the child theme overwrites code in the parent theme. Basically any changes (there are not part of the theme option settings) you want to make to the official theme you downloaded.
  2. It can speed up development time. Child themes are also perfect if you want to create custom page templates. When using a GavernWP as parent theme, you can drastically reduce the time it takes for you to create a WordPress site. A child theme built on a framework allows a great deal of flexibility without writing a lot of code.
  3. You can add your own images (photos or icons) to the child theme even if the image doesn’t exist in the parent theme folder.
  4. A child theme can also override existing parent theme files, but it can supply theme files that don’t exist in the parent.

How to use child themes

From a user’s perspective, using child themes is no different from using standard WordPress themes. Like regular themes, a child theme needs to reside in a directory inside the /wp-content/themes directory.

When you install a Gavick WP theme you upload both parent and child theme folders to /wp-content/themes/ and set your child theme as Active so only the child theme is available to use via Appearance > Themes. The parent theme must be installed, but not activated, in your site’s themes directory for the child theme to work.


Implementation of Child Themes support is associated with these two functions:

  • gavern_file_uri – returns the URI to a specific file relative to the root of the theme directory
  • gavern_file_path – returns the absolute path to a specific file relative to the root of the theme directory

Both functions accept false as an argument – these functions will then return the URI/path to the specific theme directory.

IMPORTANT! Please remember to not use the slash at the start of the file path.

In example:


The above example will return:


and using the false argument:


This example will return:


You can now override every file in your Child Theme!

When you don’t have to use Child Theme

It is important to know that sometimes you may not need a child theme. Think about the number of changes you have planned for your theme, if the changes you are planning are minor, then you can always use a “override.css” file – check Advanced Settings section in your theme to enable it. If the changes are advanced where you find yourself overriding the core parent theme files, then you probably should be creating a custom theme.

In books and blog post around the web are so many informations you can check out to study deeper into this subject. Child themes are similar solution to Joomla! Styles, because in J! Template Manager you can create duplicate (copy) of the selected template style.

WordPress Child Themes – when & how to use them 3.575 (71.43%) 7 votes

This article was first published

Villa Belluci - View our NEW theme

Tutorials & tips delivered regularly

Expand your purchase with regular tutorials and tips to making your site better, direct to your email.