WordPress.org

Support

Support » Plugins and Hacks » [Resolved] [Plugin: Content Scheduler] Pull the the expiration date

[Resolved] [Plugin: Content Scheduler] Pull the the expiration date

Viewing 4 replies - 1 through 4 (of 4 total)
  • ElDroid
    Member

    @eldroid

    Sorry I just read the PDF doc. Thanks fot this awesome plugin!

    Permarad
    Member

    @permarad

    Just for reference, to pretty up the date being pulled from the database you can use this code to get something like this. eg 10 Days 20 Hrs Remain.

    global $wp_query;
    		$postid = $wp_query->post->ID;
    
    		//Convert to date
    		$datestr=get_post_meta($postid, '_cs-expire-date', true);//Your date
    		$date=strtotime($datestr);//Converted to a PHP date (a second count)
    
    		//Calculate difference
    		$diff=$date-time();//time returns current time in seconds
    		$days=floor($diff/(60*60*24));//seconds/minute*minutes/hour*hours/day)
    		$hours=round(($diff-$days*60*60*24)/(60*60));
    
    		//Report
    		echo "$days Days $hours Hrs Remain<br />";

    @ Permarad – Thank you for the above code. Great suggestion!

    Plugin Author Paul Kaiser
    Member

    @freakingid

    Nice!
    That reminds me, I need to update the docs… I guess they’re mostly still valid, though.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] [Plugin: Content Scheduler] Pull the the expiration date’ is closed to new replies.