Can someone tell, how to check whether it's empty?
<?php bloginfo('description'); ?>
Something like:
<?php if (!empty bloginfo('description');) ?>
Thanks a lot.
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityif ( get_bloginfo( 'description' ) ) {
//do something
}
bloginfo echoes the description, get_bloginfo returns php variable
<?php if(get_bloginfo('description') <> '') { ?> // do something <?php } ?>
Ptriek's example checks if the value is true and unfortunately an empty value still evaluates to true, hence why it doesn't work as expected. Try the following instead..
<?php if( !empty( get_bloginfo('description') ) : ?>
<!-- your html -->
<?php endif; ?>
NOTE: An empty check will also ring true for empty strings, so covers exactly the same case as the code you posted in the comment on ptriek's answer..