has_tag WordPress plugin

Update: Function has been added in WordPress 2.6, so use this plugin if you’re stuck on 2.3-2.5.

The Has Tag WordPress plugin lets you call has_tag($tag) in your post loop to check if a post has a given tag, e.g. has_tag(‘games’). I needed it to customize advertising to specific pages, so I can show gaming adverts for the ‘games’ tag or shopping adverts for the ‘shopping’ tag. Note: Only works with WordPress built-in tags that were added in version 2.3. So works on Versions 2.3-2.5.

Usage in single.php or wherever your post loop is in your theme:

<?php if(has_tag(‘games’)) { ?>
…games advertising stuff….
<? } ?>


Version 0.1