Hi,
Just to clarify: Are you using an Events Manager shortcode to display the events, or a custom WP Query?
Thread Starter
jimf81
(@jimf81)
The essential grid can show the events by date order ascending, figured that bit out so I don’t have to write a query for that, however I need the specific query in addition to what essential grid (its auto written a query I guess behind the scenes) is doing to show only events that are happening on a given day or in the future.
I’m almost there but I’m rubbish with queries. Essential grid calls it an additional parameter, therefore I need a query for this process please?
Do you need it for a specific date or for any date in the future?
Thread Starter
jimf81
(@jimf81)
So I have an events page and that page should not show events that have already occurred.
So events that occur today and all those in the future, that’s the query I need.
Hello jimf8! I am looking for the same solution. I am showing Events Manager events using Essential Grid plugin. I have an additional category “Featured Events” created within Events Manager. I can select this category in Essential Grid, but the featured events will still be shown when the event is past. So I must edit every event (the category) after it is over.
Do you have a solution now?
Thanks
Chris
Did anyone find a solution to this yet? I am also trying to find a parameter query that will only shoe events today or later. Thanks
You’d need to use the events_list with the scope attribute set to future:
http://wp-events-plugin.com/documentation/shortcodes/
I am also using the Essential Grid plug-in to display the events from Event Manager. (as is chrissy264 and jimf81) Should I be able to enter [events_list scope=”future”] in the additional parameters of my grid?
I’m not sure – I’m not familiar with Essential Grid – but you’d need to add the shortcode to the same place you define the content.
Thread Starter
jimf81
(@jimf81)
I think this is Ailsa who left a comment n my you tube video about this. I got some answer from the essential grid people.
This is what I added to the functions.php file. You need to change the grid alias number. In my case below I have a query for future events, on 2 grids and a query to stop caching (I had some issues with the grid so you may need this too). You may need it all or choose which bit you need.
add_filter(‘essgrid_query_caching’, ‘eg_disable_caching’, 10, 2);
function eg_disable_caching($do_cache, $grid_id){ //disable caching for the particular grid
if($grid_id == 43 || $grid_id == 48 || $grid_id == 50){ //replace 1 with your desired grid id
return false;
}
return true;
}
add_filter(‘essgrid_get_posts’, ‘eg_modify_query’, 10, 2);
function eg_modify_query($query, $grid_id){
if($grid_id == 43 || $grid_id == 48){ //replace 1 with your desired grid id
$query[‘meta_query’] = array( ‘key’ => ‘_start_ts’, ‘value’ => current_time(‘timestamp’), ‘compare’ => ‘>=’, ‘type’=>’numeric’ );
$query[‘meta_key’] = ‘_start_ts’;
$query[‘meta_value’] = current_time(‘timestamp’);
$query[‘meta_value_num’] = current_time(‘timestamp’);
$query[‘meta_compare’] = ‘>=’;
}
if($grid_id == 50){ //replace 1 with your desired grid id
$query[‘meta_query’] = array( ‘key’ => ‘_start_ts’, ‘value’ => current_time(‘timestamp’), ‘compare’ => ‘<=’, ‘type’=>’numeric’ );
$query[‘meta_key’] = ‘_start_ts’;
$query[‘meta_value’] = current_time(‘timestamp’);
$query[‘meta_value_num’] = current_time(‘timestamp’);
$query[‘meta_compare’] = ‘<=’;
}
return $query;