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….
<? } ?>

Download:

Version 0.1


Twitter

  • Java EE looks like a good idea on paper. In practice it's just a license to overengineer and cause a slow death from leaky abstractions #FML 1 week ago
  • Who wants to hear the truth when they can hear they're right -- Clay Johnson 1 week ago
  • Paying for things with my life savings is so much harder than using my credit card. #humanflaws 1 week ago
  • Why are software development task estimations regularly off by a factor of 2-3? Best manager-level answer ever. http://t.co/gpteliNU 1 week ago
  • More updates...

Posting tweet...