Skip Navigation

[Resolved] Views to display The Events Calendar upcoming events

This thread is resolved. Here is a description of the problem and solution.

Problem:
Views to display The Events Calendar upcoming events

Solution:
The issue was user added the query filter for _EventStartDate as a string and we just changed it to a number.

You can find the proposed solution in this case with the following reply:
https://toolset.com/forums/topic/views-to-display-the-events-calendar-upcoming-events/#post-1151142

Relevant Documentation:

This support ticket is created 6 years, 1 month 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 2 replies, has 2 voices.

Last updated by tylerG 6 years, 1 month ago.

Assisted by: Minesh.

Author
Posts
#1150865

I've been using Toolset Views to display upcoming event for The Events Calendar for a while but for some reason I can't get it to work lately. Here are the steps I've been taking:

1.) Go to Toolset settings and add TEC start date field to Toolset: hidden link
2.) Add that field into the View for ordering and filtering: hidden link
3.) I found this snippet from another support post to help:

add_filter( 'posts_where' , 'func_posts_where' );
function func_posts_where( $where ) {

global $wpdb;
global $WP_Views;

if($WP_Views->current_view == 479){

$where = str_replace("CAST(mt1.meta_value AS SIGNED)","UNIX_TIMESTAMP(mt1.meta_value)",$where);

}
return $where;
}

The problem is all events are now showing instead of only events for today and in the future. Has something changed that I need to update on my end? Thank you for any suggestions!

#1151142

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Well - the issue was you added the query filter for _EventStartDate as a string I just changed it to number as you can see with the following screenshot:
=> hidden link

I can see now its just working fine. Could you please check now.
=> hidden link

#1151391

Thanks for the help!