Skip to content

Instantly share code, notes, and snippets.

@billerickson billerickson/functions.php Secret
Last active Jan 4, 2019

Embed
What would you like to do?
<?php
/**
* Display Posts - List upcoming events from The Events Calendar
* @see https://displayposts.com/2019/01/04/display-upcoming-events-from-the-events-calendar/
*/
function be_dps_future_events( $args, $atts ) {
// Only run on event queries
if( 'tribe_events' != $args['post_type'] )
return $args;
$args['order'] = 'ASC';
$args['orderby'] = 'meta_value';
$args['meta_key'] = '_EventStartDate';
$args['meta_type'] = 'DATETIME';
$args['meta_query'] = array(
array(
'key' => '_EventStartDate',
'value' => date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ),
'compare' => '>'
) );
return $args;
}
add_filter( 'display_posts_shortcode_args', 'be_dps_future_events', 10, 2 );
@uvdesign

This comment has been minimized.

Copy link

commented Feb 27, 2018

Is there a way to display the event start date?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.