Skip Navigation

[Gelöst] Comparation date

This support ticket is created vor 6 Jahren, 3 Monaten. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Dieses Thema enthält 15 Antworten, hat 5 Stimmen.

Zuletzt aktualisiert von Minesh vor 6 Jahren, 2 Monaten.

Assistiert von: Minesh.

Author
Artikel
#1104267

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.