How do I check for a tag's existence in a post in Wordpress?

Posted by Sean on Stack Overflow See other posts from Stack Overflow or by Sean
Published on 2010-03-30T08:35:10Z Indexed on 2010/03/30 8:43 UTC
Read the original article Hit count: 379

Filed under:
|
|

Hey all,

Quick question about Wordpress PHP: I am writing a theme and I want to display (on the main index page) one icon if my post has one tag, and another if it has the other.

I wrote something like

<?php has_tag('pc') { ?><img src="<?php bloginfo('template_directory'); ?>/images/pc-icon.gif"><?php }; ?>
<?php has_tag('mb') { ?><img src="<?php bloginfo('template_directory'); ?>/images/mb-icon.gif"><?php }; ?>

But it gives me an error. Can anybody help?

Thanks

© Stack Overflow or respective owner

Related posts about Wordpress

Related posts about php