get_bloginfo()
is not cached and calling it over and over would harm your performance just like creating many calls to the database yourself.
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
function set_get_my_blog_info(){
$my_blog_info = get_option('my_blog_info');
if ($my_blog_info === false){
global $wp_version
$lang = get_locale();
$lang = str_replace('_', '-', $lang);
$my_blog_info = array(
'url' => home_url(),
'wpurl' => site_url(),
'description' => get_option('blogdescription'),
'rdf_url' => get_feed_link('rdf'),
'rss_url' => get_feed_link('rss'),
'rss2_url' => get_feed_link('rss2'),
'atom_url' => get_feed_link('atom'),
'comments_atom_url' => get_feed_link('comments_atom'),
'comments_rss2_url' => get_feed_link('comments_rss2'),
'pingback_url' => get_option('siteurl') .'/xmlrpc.php',
'stylesheet_url' => get_stylesheet_uri(),
'stylesheet_directory' => get_stylesheet_directory_uri(),
'template_url' => get_template_directory_uri(),
'admin_email' => get_option('admin_email'),
'html_type' => get_option('html_type'),
'version' => $wp_version,
'language' => $lang
);
update_option('my_blog_info',$my_blog_info);
}
return $my_blog_info;
}
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
global $my_blog_info;
$my_blog_info = set_get_my_blog_info();
and after you do that you can use that array anywhere you want in your theme, for example instead of:
echo get_bloginfo('url');
simply use your array:
echo $my_blog_options['url'];