I was just wondering if calling get_bloginfo too many times was going to harm performance in a theme and if the data should just be put into its own var?
|
|
a simple solution which doesn't evolve any caching in to minimize the database and function calls by defining a an array with all the info you need and save that as an option in the wp_options table. then in your header.php globalize a variable and assign that option to it and every were in your them you can just use that, something like this: in your functions.php
this will save most of the get_bloginfo options into one option in the database and will only run once. then in your header.php add
and after you do that you can use that array anywhere you want in your theme, for example instead of:
simply use your array:
|
|||
|
|
While there is no inherent caching in Holding value you need in a variable for using several time is still (marginally in most cases) faster than function call, but I wouldn't bother with explicit dedicated caching. |
|||
|