- This topic has 7 replies, 4 voices, and was last updated 3 years, 1 month ago by David.
April 28, 2019 at 6:07 pm #882644Dean
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?
DeanApril 29, 2019 at 8:43 am #883377TomLead DeveloperLead Developer
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! 🙂April 26, 2020 at 3:17 pm #1256945Anonymous
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?April 26, 2020 at 4:54 pm #1257014TomLead DeveloperLead Developer
A child theme adds an additional
style.cssfile to your site, but that’s the only difference performance-wise that it will make.April 26, 2020 at 6:00 pm #1257056Anonymous
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?April 27, 2020 at 5:20 am #1257609DavidStaffCustomer Support
in comparison to adding Functions using a plugin – i can’t see there being any performance differences.April 27, 2020 at 12:15 pm #1258426Anonymous
Thanks David.April 28, 2020 at 2:26 am #1259124DavidStaffCustomer Support
Glad we could be of help
- You must be logged in to reply to this topic.