Skip Navigation

[Resolved] Events removed from Toolset feed before they occur

This support ticket is created 4 years, 10 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/Hong_Kong (GMT+08:00)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 4 years, 10 months ago.

Assisted by: Luo Yang.

Author
Posts
#1271995

We have built a feed using Toolset on the page linked below. We noticed that the events are being removed before the start time. Ideally, they would be removed at 12am the day after the start date.

We are using the following logic to display the posts:
"EventStartDate is greater than or equal to today()"

I checked the main TEC feed and noticed that the behavior is slightly different. Rather than pulling the event out of the feed at 12am the day of the event (as it seems to in the Toolset feed) the events get pulled out as soon as the start time is reached.

Link to a page where the issue can be seen:
hidden link

#1272205
ts-filter.JPG

Hello,

There isn't such a built-in feature within Views plugin, in your case, you can create a custom shortcode to get the timestamp value of today's 12AM, then pass it to view.

For example:
1) Create a custom shortcode "today_12am_ts", put below codes into your theme file functions.php:

add_shortcode('today_12am_ts', function($atts, $content){
	return strtotime('Today 12am', current_time('timestamp'));
});

2) Dashboard-> Toolset-> Settings-> Front-end Content
in section "Third-party shortcode arguments", add the shortcode name: today_12am_ts

3) Edit your post view, change the date field filter as below:
Select items with field:
EventStartDate is a number greater than or equal VIEW_PARAM(ts)

See screenshot ts-filter.JPG

4) Display above post view's shortcode as below:

[wpv-view name="VIEW-SLUG" ts='[today_12am_ts]']

More help:
Controlling the filter with shortcode attributes
https://toolset.com/documentation/user-guides/passing-arguments-to-views/#controlling-the-filter-with-shortcode-attributes

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