Sunday, June 6, 2010

add an expiration date to your article

February 8, 2010 by admin · Leave a Comment 

This hack is very useful when you have a contest on the site. You can put a timeout for an article.

All you have to do is to modify the index.php and change the following code:

<br><br>&lt;?php<br>if (have_posts()) :<br>while (have_posts()) : the_post(); ?&gt;<br>$expirationtime = get_post_custom_values('expiration');<br>if (is_array($expirationtime)) {<br>$expirestring = implode($expirationtime);<br>}<br><br>$secondsbetween = strtotime($expirestring)-time();<br>if ( $secondsbetween &gt; 0 ) {<br>// For example…<br>the_title();<br>the_excerpt();<br>}<br>endwhile;<br>endif;<br>?&gt;<br><br>

after that you must add the field names that have expiration format mm / dd / yyyy 00:00:00

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • FriendFeed
  • Netvibes
  • Reddit
  • RSS
  • Suggest to Techmeme via Twitter
  • Tumblr
  • Twitter
  • Twitthis
  • Blogosphere News
  • email
  • LinkedIn
  • Linkter
  • Live
  • MyShare
  • MySpace
  • Ping.fm
  • StumbleUpon
  • Technorati
  • Yahoo! Bookmarks
  • Yahoo! Buzz

Related posts:

  1. Custom css for article
  2. Wordpress – external link to an article
  3. Add multiple authors to an article
  4. use randoms images in header

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!

SEO Powered by Platinum SEO from Techblissonline