I’d like to echo out a few lines of HTML as well as my tagline if the tagline exists. I’m not sure how to check if a tagline exists.
Here is where I’m up to:
<?php if (bloginfo('description'))
echo '<div class="tagline-message"><div><h3>
<?php bloginfo("description"); ?>
</div></div></h3>'
?>
This doesn’t work as saying bloginfo(‘description’) in the if condition is not the correct usage of bloginfo()
How do I check if a tagline exists?
Thanks!
– Mikey
You should be using
get_bloginfo()
(you need toreturn
the value to the conditional, rather than print/echo it):Use the
get_option
method to determine if a setting exists. It will returnfalse
if no value exists for the setting. Note thatblogdescription
is the setting name for Tag Line.Reference: https://codex.wordpress.org/Function_Reference/get_option