- This topic has 7 replies, 3 voices, and was last updated 8 years, 6 months ago by Tom.
-
AuthorPosts
-
September 26, 2015 at 7:17 am #139884Mo
Hi Tom,
Please bear with me as I try to explain the question.With themes previously used, if/when custom theme files were made and added to a child theme such as templates or header.php, footer, page.php, single.php, index.php, sidebar.php, etc. there werwn’t any quams regarding missing out on the benefits of theme updates. For the most part there just weren’t updates occurring often enough to be concerned about it.
GP and GP Premium are a different story. In your quest for theme optimization and bug fixes, there seem to be frequent updates occurring at least every 2 weeks or less. Correct me if I’m wrong on that. That’s true commitment which makes GP and GP premium and exceptional product.
The concern is that if custom files are placed in the child theme to avoid being overwritten, will they degrade the continuing improvements made to the overall theme?
Performance and SEO with regard to Google are ongoing so having a theme performing optimally is critical. Page load time and being W3C compliant may not directly affect SERPS but it certainly has an impact on the user experience.
With Google putting the emphasis on delivering the best experience for mobile devices it’s a priority that needs constant monitoring.
For example, you’re aware that there’s a custom footer.php on my site to accommodate the tertiary menu. Will it eventually suffer performance or bug issues by not being updated with the rest of the theme?
Initially I was manually transposing the custom code to the updated footer and then placing it in the child theme. This was probably unnecessary which is why I’m seeking confirmation.
If this concern is unclear, please ask for clarification.
Thanks once again for your superb efforts and support.
September 26, 2015 at 9:59 am #139898TomLead DeveloperLead DeveloperHi Mo,
Short answer – it can.
As I’m always updating things, if you’re overwriting certain files in your child themes, you’ll miss those updates.
Missing those updates probably won’t hurt your performance, but you will miss out on small fixes and improvements.
This is why I prefer the use of hooks over using custom child theme files.
With hooks, you place your code (menu in this example) in a function, and then hook it into the theme.
For example, if you wanted to add something before the footer:
add_action( 'generate_before_footer','generate_add_code_before_footer' ); function generate_add_code_before_footer() { ?> Everything inside this area will be added before the footer. Anything and everything can go in here. <?php }
You can see a full list of our hooks here: https://generatepress.com/knowledgebase/hook-list/
Otherwise, you can just pay attention to our changelogs for each update. I’ll mention if specific template files have been changed. If you see that I’ve made a change to a file you have in your child theme, you can review the file and make the change if necessary.
I personally prefer the hook method.
Let me know if you need more info! π
September 28, 2015 at 5:23 pm #140504MoHi Tom,
Thanks for the response.
I didn’t get an email in my box about your response so sorry for the lag.====
That makes perfect sense.
I wondered about using hooks.
Since this site is currently in development mode, it would offer the perfect opportunity to try them out.
If things don’t work, I’ll contact you.
Thanks again.
September 28, 2015 at 6:25 pm #140511MoUsing hooks would seem the preferable and efficient manner of custom coding.
The “add action” string you’ve used is the usual way to apply the code in hooks?
My knowledge of php is minimal.
It appears that the proper syntax could probably be found in the theme files and then applied in the hook?
===
CSS is still applied through the style file and not the hooks?
Thanks.
September 28, 2015 at 6:54 pm #140512bdbrownIf you’re interested here is a good introduction to actions, hooks and filters.
September 28, 2015 at 10:52 pm #140531TomLead DeveloperLead DeveloperThe first string in the add_action function is the hook name (found on the link I posted).
The second part is the function name.
Simplified:
add_action('generatepress_hook_name','my_function_name'); function my_function_name() { ?> My hooked content <?php }
September 29, 2015 at 6:19 am #140666MoThanks for the info Tom & bdbrown.
I believe I’ve seen bdbrown helping out on wordpress.org’s support forum.
Coincidentally I was just checking out the filters page this morning and wondered if it might be useful in some capacity for the current and future builds.
Now I can find out.
===
Wouldn’t the world be better place if it was run like GP! π
September 29, 2015 at 9:27 am #140694TomLead DeveloperLead DeveloperGlad we could help, Mo! π
-
AuthorPosts
- You must be logged in to reply to this topic.