Set an Expiry Date for WordPress Content

Introduction
This tutorial will teach you how to apply an expiry date to post content using shortcodes.
This means that you can apply it to anything, from limited special offers to events which will disapear on the date you specify!
Add the following code to the functions.php file of your theme (remeber you should always take a back-up before editing any core files) :
add_shortcode('expire','expire_text');
function expire_text($paras="",$content="") {
extract(shortcode_atts(array('date'=>''),$paras));
if ( ($date!="")&&(date("Ymd")>$date) ) {$content="";}
return $content;
}
With that code installed you can now surround your content with the following shortcode, replacing YYYYMMDD with the date you want the content to expire.
[expire date="yyyymmdd"][/expire]
Here’s a quick example:
[expire date="20120101"]This content will disapear in 2012![/expire]
