Navigation überspringen

[Gelöst] How do I compare TODAY() to a future date (constant not custom field) ?

This support ticket is created vor 2 Wochen, 6 Tage. 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.

Dieses Thema enthält 1 Antwort, hat 1 Stimme.

Zuletzt aktualisiert von jeffS-2 vor 2 Wochen, 2 Tage.

Author
Artikel
#2814343

Tell us what you are trying to do?
I want to use [wpv-conditional] to display some text only when TODAY() is LE (some future date).

[wpv-conditional if="( TODAY() le 'FUTURE DATE' )"]

Note that I do not have a custom date field for this so I need to have a constant or string for FUTURE DATE.

THE EXACT SITUATION:
I have a temporary limited time discount to join a membership. It will start now, but I want to stop automatically displaying the page showing the discount, and instead show "Sorry, this discount to join has ended."

I hope that is clear and understandable!
Jeff

#2814451

Christopher Amirian
Unterstützer

Sprachen: Englisch (English )

Hi Jeff,

Welcome to Toolset support.

I will answer this ticket before the ticket is assigned to one of my colleagues.

Toolset’s [wpv-conditional] can handle date comparisons, but TODAY() only works when you compare it to a field or shortcode that outputs a proper date string — not a fixed date string by itself.

Please check if the solution like the one mentioned here can be used for your scenario:

https://toolset.com/forums/topic/conditional-logic-by-date/

If not, I will need more detailed information on how you want to do the comparison.

Thanks.

#2814692

no