Home Forums Basel support forum Declare Global Variables for Customization

Declare Global Variables for Customization

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #14895

    svaldesm
    Participant

    Hello,

    I need to show some icons in my product page. They depend on product attributes (they are like a score).
    I’ve made a function to convert the value of the attribute ($value = 1) into icons (with a for()). This is stored in functions.php and called in the template.

    The thing is that obviously this is not the smartest way to do it because of memory. I assume that if for every product page, WP has to run the same function over and over…I should save it globally, but there is a lot of advice against this on the internet.

    What’s the way to go about this? Thanks!

    #14902

    Artem Temos
    Keymaster

    Hi,

    You can use your function for each product without worries, it should not impact your website speed.

    Regards

Viewing 2 posts - 1 through 2 (of 2 total)