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

  • Shotguns and glocks at the shooting range. Best. Present. Ever! 2 weeks ago
  • Tasty icecream sammiches on my SGS2 thanks to Cyanogenmod 9 nightly build 20120423 (20120425 broken). http://t.co/Co76xYQY 3 weeks ago
  • I think the only proper and gentlemanly thing to do is buy an iPad 3 so I can give my iPad 2 to Mariel... 3 weeks ago
  • TIL that Fallout stole a pile of ideas from Battle for the Planet of the Apes. Bomb worship, mutants, and more. #vintagescifinight 3 weeks ago
  • More updates...

Posting tweet...