Problem: I would like to set up a conditional that tests the time of the most recent post edit. If the most recent edit was less than 5 minutes ago, I would like to show some content.
Solution: Use the wpv-post-date shortcode to output a Unix timestamp, subtract that value from NOW(), and compare that value against the number of seconds in 5 minutes (300) using the following syntax:
[wpv-conditional if="( (NOW() - [wpv-post-date type="modified" format="U"] ) lt 300 )"] ...the most recent edit was less than 5 minutes ago... [/wpv-conditional]
Relevant Documentation:
https://toolset.com/course-lesson/using-toolset-conditional-block/
https://toolset.com/documentation/programmer-reference/forms/cred-conditional-display-engine/
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#vf-154574
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 |
---|---|---|---|---|---|---|
8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - | - |
13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | - | - |
Supporter timezone: America/New_York (GMT-04:00)
This topic contains 2 replies, has 2 voices.
Last updated by 3 years, 7 months ago.
Assisted by: Christian Cox.