Minesh
Supporter
Sprachen:
Englisch (English )
Zeitzone:
Asia/Kolkata (GMT+05:30)
Well - I've added following shortcode to your current theme's functions.php file:
function func_display_status() {
global $post;
static $j = 0;
$a = shortcode_atts( array(
'format' => 'U'
), $atts );
/*calculating booking deadline */
$days_release = get_post_meta( $post->ID, 'wpcf-release', true );
$convert_release = ($days_release * 24 * 60 * 60);
/* getting partenze value */
$date_partenza = get_post_meta( $post->ID, 'wpcf-partenze');
$partenze = $date_partenza[$j];
/* geting actual deadline */
$deadline = ($partenze - $convert_release);
$j = $j+1;
if($partenze <= time()){
return "Closed";
}else if ($partenze > time() and $deadline < time()){
return "On request";
}else if ($partenze > time() and $deadline > time()){
return "Open";
}else if ($deadline <= time()){
return "Last Day";
}
}
add_shortcode('show_status', 'func_display_status');
As you can see its using $deadline and $partenze fields.
You should use above shortcode as [show_status] wherever you want to display the status.
- if [partenze] is equal to [today] = Close
==> OK - its covered
- if [booking-deadline] is equal to [today] = Last day
==> Ok - its covered
- if [partenze] is lower then [today] and [booking-deadline] is lower then [today]= Close
==> No need for this conditions as [partenze] is lower then [today] we want to display the status = Close.
- if [partenze] is greater then [today] and [booking-deadline] is lower then [today]= On request
=> OK - its covered
- if [partenze] is greater then [today] and [booking-deadline] is greater then [today]= Open
==> Ok, its covered.