Skip Navigation

[Resolved] Help to display text based on post date.

This support ticket is created 5 years, 9 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
- 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)

This topic contains 4 replies, has 2 voices.

Last updated by Dee_DeeA2948 5 years, 9 months ago.

Assisted by: Minesh.

Author
Posts
#1191633

Tell us what you are trying to do?
I am trying to display text based on post date. For example:
IF post date is less than or equal to January 26, 2019 SHOW "abc"
IF post date is greater than January 26, 2019 SHOW "xyz"

#1191805

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - you can use views shortcode [wpv-condtional] to check the post date field conditionally.

For example - to chceck the post date against today's date:

[wpv-conditional if="( '[wpv-post-date format="U"]' gt 'TODAY()' )"]
post date is greater than today's date
[/wpv-conditional]

[wpv-conditional if="( '[wpv-post-date format="U"]' lt 'TODAY()' )" ]
post date is less than today's date
[/wpv-conditional]

You can find the list of function which you can use with the conditional statement with the following Doc:
=> https://toolset.com/documentation/user-guides/date-filters/

More info:
=> https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
=> https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-date

#1192601

Thank you. This is what I was looking to do, but I didn't want to reference "today". I wanted a specific date in time. I found the examples that referenced "today", but I wasn't able to find an example of how to insert a certain date?
For example:

IF post date is less than or equal to January 26, 2019 SHOW "abc"
IF post date is greater than January 26, 2019 SHOW "xyz"

Thank you for your help.

#1192606

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

What if you try to use the Date function:

For example:

[wpv-conditional if="( '[wpv-post-date format="U"]' gt 'DATE(26,01,2019)' )"]
post date is greater than 26th Jan 2019
[/wpv-conditional]
#1192618

My issue is resolved now. Thank you!