-
-
Save billerickson/5238bae72ce0c21ca458c577c6b390e8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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