Skip Navigation

[Gelöst] Conditional dates not switching content

This support ticket is created vor 6 Jahre, 9 Monate. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

This topic contains 2 Antworten, has 2 Stimmen.

Last updated by guyA-2 vor 6 Jahre, 9 Monate.

Assisted by: Luo Yang.

Author
Artikel
#552968

Hi

We're trying to show specific content on the front-end based on whether or not a date has passed. Specifically this is an early bird price and a full price. We're using the following conditional shortcode in our content template, but when we test it by changing the early bird expiry date (the value in the wpcf-early-bird-expiry-date field), the content isn't switching. Is there something wrong with our logic here? Should we not be using less than & greater than for time?

This is the page it relates to: hidden link

[wpv-conditional if="( $(wpcf-early-bird-expiry-date) lt 'time' )"]
[types field='early-bird-price-shortcode'][/types]
[/wpv-conditional]
[wpv-conditional if="( $(wpcf-early-bird-expiry-date) gt 'time' )"]
[types field='full-price-shortcode'][/types]
[/wpv-conditional]

Thanks.

#553286

Dear guyA-2,

Please try this:
1) Dashboard-> Toolset-> Settings-> Front-end Content
in option "Functions inside conditional evaluations", fill the function name: time

2) modify your codes as below:

[wpv-conditional if="( $(wpcf-early-bird-expiry-date) lt time() )"]
[types field='early-bird-price-shortcode'][/types]
[/wpv-conditional]
[wpv-conditional if="( $(wpcf-early-bird-expiry-date) gt time() )"]
[types field='full-price-shortcode'][/types]
[/wpv-conditional]

And test again, more help:
hidden link
time — Return current Unix timestamp

#553384

Thanks for your help.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.