Meet GavernWP v.1.6 provides full support for the Child Themes mechanism. Our users now have the ability to modify a theme without worrying that the theme update will clear out the changes.
Implementation of Child Themes support is associated with 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.
The above example will return:
and using the false argument:
This example will return:
You can now override every file in your Child Theme! Please keep in mind certain dependencies.
In the example, you can copy the template.css file and change it, but then you will also need to import the images directory to your Child Theme because the theme will use the CSS from the Child Theme’s directory, which itself links to the images directory in the Child Theme’s directory.
OK, but what if you want to add some CSS or PHP code, without using original files? Remember that if you override a file, then you must add modifications manually if they will be added in the theme during update.
In this case you can use two files:
- css/override.css – for your own CSS code (remember to enable this file in the theme’s Advanced settings tab)
- gavern/user.functions.php – for your own PHP code With the above files, you needn’t worry about adding update changes to your overrided files.
The Child Themes support will be added to our premium themes on the nearest update.