Site logo

Archived topic

Child Theme Performance

7 replies · Started by Dean on April 28, 2019

Viewing posts 1–8 of 8

Hi Tom.

Been told to post this here.

I have some questions about performance and child themes.

Currently the way I use GenPress is to create a new website using GenPress on localhost. Once I am happy with the design, I then create a child theme and copy the settings from the customiser into PHP.

The end result is like your child themes Statement, Freelancer, Mantle etc on the WordPress repository. All the customiser settings are in the functions.php file.

So my questions are:

1) Which method is better for performance? Creating a child theme using PHP options like I currently do, or just entering and saving the settings in the customiser? I am unsure as I would of thought by using PHP it avoids GP having to get the options from MySQL database, but then you also have some "Cache dynamic CSS" system going on.

2) Do you have a complete list of all the functions and variables? Something like this (https://generatepress.com/forums/topic/how-can-i-create-a-child-theme-that-comprehends-customizer-settings/)? I have my own, but I think it is probably out of date now.

3) Do you have any further tips regarding making child themes?

Thank you.

Kind regards,
Dean

Hey Dean,

1. I doubt there is much of a difference. We put our options into a variable, and when we define that variable, we add the defaults as a fallback if no option exists.

What you're doing is setting the defaults, then WP checks for the option and uses the default if no value exists in the database.

Performance-wise, I wouldn't choose one over the other.

2. We don't have a complete list, but we should. We'll try to get that added to the docs soon. In each of the modules, you'll find a function which defines all of the defaults - usually near the top of the main functions file, or in a defaults.php file.

3. Use filters and hooks where possible instead of overwriting entire functions/template files. Other than that, there's not much else to do when it comes to child themes.

Hope this helps! :)

Hi Tom,

To clarify, is there a performance impact when using the child theme?

If yes, when does this occur and what are the options to optimize the degradation if any?

A child theme adds an additional style.css file to your site, but that's the only difference performance-wise that it will make.

Thanks Tom. Is the difference in using the child theme/functions.php measurable or is it negligible? For example, do the additional functions have a negative impact to the overall performance?

Hi there,

in comparison to adding Functions using a plugin - i can't see there being any performance differences.

Thanks David.

Glad we could be of help

This archived topic is closed to new replies.