[Resolved] Functions.php vs Hooks Element

Home Forums Support [Resolved] Functions.php vs Hooks Element

Home Forums Support Functions.php vs Hooks Element

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #998371
    docdanijb

    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

    #998376
    David
    Staff
    Customer Support

    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.

    #998384
    docdanijb

    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

    #998388
    David
    Staff
    Customer Support

    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:

    https://codex.wordpress.org/Conditional_Tags

    #998390
    docdanijb

    Thanks, appreciate it!

    #998393
    David
    Staff
    Customer Support

    You’re welcome

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.