Reputation: 627
Here is the code that I am referring to:
<?php if ( is_archive() ) { echo '<img src="'.bloginfo('template_url').'/images/test.png" />'; }?>
This is what the code outputs: http://site.com/wp-content/themes/themename
I'd like it to output the actual image in the code. What part of this did I overlook?
Upvotes: 0
Views: 107
Reputation: 378
Have you tried this:
$template_url = get_bloginfo('template_url');
<?php if ( is_archive() ) { echo '<img src="'.$template_url.'/images/test.png" />'; } ?>
Upvotes: 0
Reputation: 2246
bloginfo()
doesn't output the string. It echo's it directly to output stream.
So, the code should be:
<?php if ( is_archive() ) { ?>
<img src="<?php bloginfo('template_url'); ?>/images/test.png" />';
<?php } ?>
Or else, you can use get_bloginfo()
:
<?php if ( is_archive() ) { echo '<img src="'.get_bloginfo('template_url').'/images/test.png" />'; }?>
Upvotes: 1