Skip Navigation

[Resolved] Conditional does not seem to work as expected

This support ticket is created 3 years, 11 months ago. 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.

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/Karachi (GMT+05:00)

This topic contains 2 replies, has 2 voices.

Last updated by matthewL-7 3 years, 11 months ago.

Assisted by: Waqar.

Author
Posts
#1967055

Hi

I have manually setup a conditional in the block editor. The conditional I have written is as follows:

  ( ( '[types usermeta="offer-date"][/types]' gte TODAY() ) ) 

When a date is set regardless of if its in the future or past the content shows up.

I enabled debug.

####################
wpv-conditional attributes
####################
Array
(
    [if] =>   ( ( '18th February 2021' >= TODAY() ) ) 
    [debug] => true
)

####################
Debug information
####################
--------------------
Original expression:   ( ( '18th February 2021' >= TODAY() ) ) 
--------------------

What I am attempting to do is hide the content if the date from field "offer-date" is in the past.

Thanks.

#1967639

Hi,

The date comparisons like TODAY() require the value to be in the Unix timestamp format. For this reason, including the attribute output="raw" fixes this:


( ( '[types usermeta="offer-date" output="raw"][/types]' gte TODAY() ) ) 

regards,
Waqar

#1968417

Perfect thank you! 🙂