cdogstu99 Posted July 2, 2010 Share Posted July 2, 2010 I have a website which lists deals that expire. Each deal has a custom field with an expiration date. I'm looking to somehow archive the posts when they expire, yet still have them available if you access the link to the deal (since i don't lose SEO impact). I also would like to have them disappear from the category they are held in. I tried this code in my home page (loop) and also put the same code in my category page loop. ***PUT THIS INSIDE THE LOOP, FIRST THING*** <?php //to check against expiration date; $timestamp = strtotime("now + 8 hours"); $currentdate = date('YmdHis', $timestamp); $expirationdate = get_post_custom_values('expiration'); if (is_null($expirationdate)) { $expirestring = '30005050235959'; //MAKE UN-EXPIRING POSTS ALWAYS SHOW UP; } else { if (is_array($expirationdate)) { $expirestringarray = implode($expirationdate); } $markup = array("/",":"," "); $expirestring = str_replace($markup,"",$expirestringarray); } //else if (( $expirestring > $currentdate ) || (is_archive())) { ?> ***THEN PUT THE FOLLOWING LINE AT THE VERY END OF THE LOOP*** <?php } //end if for expiration; ?> I was able to have the expiring posts disappear from the home page and archived, but the listing still remained in the category the deal is posted in. Anyone know how to do this? Quote Link to comment Share on other sites More sharing options...
cdogstu99 Posted July 2, 2010 Author Share Posted July 2, 2010 Bump..anyone? This is driving me crazy! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.