I have a view that displays events based on the specified event category in it's shortcode. I would like to limit the view to only show events that are today or in the future.
The field I'm trying to base this on is the _EventStartDate field (generated by Modern Tribe Events Calendar Pro plugin) that I've pulled in via the Hidden Custom Fields area, but I've not been able to get it to work.
Initially I tried modifying the query filter in the view, and then tried setting a conditional statement around the content inside the view loop. But I've been successful with neither (see screenshots).
Worth mentioning: I had to use a separate function/shortcode to get the date to display the way I wanted originally. Here's that function and the shortcode I used with it:
// The Function
function func_date_format($atts) {
global $post;
$format = $atts["format"];
$date = $atts["date"];
return date($format, strtotime($date));
}
add_shortcode("date-format", "func_date_format");
// The Shortcode
[date-format date="[wpv-post-field name='_EventStartDate']" format="F j"]
I'm hoping you can help me figure out what I'm doing wrong.
Hello. Thank you for contacting the Toolset support.
The thing is that _EventStartDate stores the date value as date string and we need timestamp to compare the date so we need to convert the date string to the timestamp.
please replace the shortcode you are using with following to your functions.php file.