Archived topic
Functions.php vs Hooks Element
5 replies · Started by docdanijb on September 1, 2019
Is there any difference in site loading speed / resource hogging etc. in regards to:
1. Adding code through functions.php
vs
1. activating Elements in GP
2. Adding code through Elements
In addition; will the code only load on the relevant page (if Display rules/Location is set)?
Thanks!
Yours,
Daniel
Hi there,
if there is any difference it would be negligible.
Yes, the code is wrapped within a conditional so will only be added if that applies.
So, as I read that; it’s in other words better to use conditions for specific functions, than to add it general in functions.php
Yes, unless you're looking to add a function, script or other content across your entire site then conditionals are required. Elements makes this so much easier to do.
You can of course include conditionals in your own functions:
Thanks, appreciate it!
You're welcome