Support » Plugin: Content Scheduler » [Plugin: Content Scheduler] Pull the the expiration date

Viewing 4 replies - 1 through 4 (of 4 total)
  • Sorry I just read the PDF doc. Thanks fot this awesome plugin!

    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

    (@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 ‘[Plugin: Content Scheduler] Pull the the expiration date’ is closed to new replies.