WordPress get_bloginfo()

WordPress’ bloginfo() is use to display information about your site such a the name or the or the template directory.

You can use it like this:

<?php bloginfo(‘template_directory) ?>

What you can’t do is to assign it to a variable. Why? because bloginfo() prints its output to the browser and create an error. If you want to use is at a variable or evaluate it then simply use the “get_” prefix like this:

<?php $template = get_bloginfo(‘template_directory) ?>

The difference is get_bloginfo() will return a value instead of echoing it.

WordPress Codex

The WordPress codex is an amazing resource for WordPress developers for more information about bloginfo() and get_bloginfo() check it out.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>