Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created August 21, 2019 18:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/5238bae72ce0c21ca458c577c6b390e8 to your computer and use it in GitHub Desktop.
Save billerickson/5238bae72ce0c21ca458c577c6b390e8 to your computer and use it in GitHub Desktop.
<?php // don't include this line
/**
* DPS Event Manager Queries
* @see https://wordpress.org/support/topic/show-events-from-events-manager-plugin/
*/
function be_dps_event_query( $args, $atts ) {
// Only run on event queries
if( empty( $args['post_type'] ) || 'event' != $args['post_type'] )
return $args;
$args['orderby'] = 'meta_value_num';
$args['meta_key'] = '_event_start_date';
$args['order'] = 'ASC';
$meta_query = array(
array(
'key' => '_event_end_date',
'value' => time(),
'compare' => '<',
)
);
$args['meta_query'] = $meta_query;
return $args;
}
add_filter( 'display_posts_shortcode_args', 'be_dps_event_query', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment