Archived topic
Recovery from buggy code in an element.
3 replies · Started by John on December 10, 2020
Good Day,
I'm a new uses porting a membership site from Thesis to GP. So far very impressed.
I'm used to hooking code on to change stuff using a child theme. But I was checking out elements and that seemed a cooler way to do it.
Two questions:
1). What happens if the code I enter into elements throws a fatal error (I suck a bit as a coder)? How do I recover? Same as the code snipits plugin, or is the a better way in elements?
2). Is there any performance hit for using elements instead of the functions file in a child theme? I have a bunch of stuff to hook on.
I searched around the forum but did not find the answer to either.
Thanks
John
1). What happens if the code I enter into elements throws a fatal error (I suck a bit as a coder)? How do I recover? Same as the code snipits plugin, or is the a better way in elements?
Yes that's right. You'll have to go to your database's wp_posts table and look for the gp_element post type that caused the issue and delete/modify it.
2). Is there any performance hit for using elements instead of the functions file in a child theme? I have a bunch of stuff to hook on.
Hook Elements main use is for hooking your markup and you want display rule conditions for it.
For other hooks and filters, if its going to be a lot, then you may as well create a child theme for templates or functions.php for these things.
But to directly answer the question, if you mean Google PSI or GTMetrix result, then it depends on what you're hooking in. Things that load large images or scripts that calls for external resources will surely affect the performance (example: ads, video embeds, images, etc ).
Hi Elvin,
Thanks for that, very informative. I will stick with a child theme. Feeling around in the data base every time my code threw a fatal error could become a full time job given my coding skills!
Thanks for that, very informative. I will stick with a child theme. Feeling around in the data base every time my code threw a fatal error could become a full time job given my coding skills!
No problem. :)