##Function to render the shortcode
function compliance_status_function($atts) {
//get post id
global $post_ID;

//initialize expired variable
$expired = true;

//get input parameters
extract(shortcode_atts(array(
‘type’ => ”,
), $atts));
$type = ($type==” ? $type : $type.’-‘);

//set today’s date
$todays_date = date(“Y-m-d”);

//Get status from meta data
$exp_date = get_post_meta($post_ID,”compliance-{$type}expires”,true);

if ($exp_date != ”) {
$today = strtotime($todays_date);
$expiration_date = strtotime($exp_date);

//compare the dates to see if it is expired or not
$expired = ($expiration_date > $today);
}
//Print it out
if ($expired)
echo “”;

else
echo “”;
}

Leave a Reply