I have a Beaver Themer Archive page that uses the Posts Slider module to rotate through posts and would like to come up with a workaround to show only past posts in the slider. I have a custom query to show the ‘Events’ post type, but there is no query option for showing past/future/etc.
I found someone wanting to do something similar with upcoming events that tried this:
<?php
$today = date('Ymd');
$args=array(
'post_type' => 'tour-date',
'meta_query' => array(
array(
'key' => 'event_date',
'compare' => '>',
'value' => $today,
)
),
);
// get posts
$posts = get_posts($args);
?>
and a filter to start with:
function fl_builder_loop_query_args_filter( $query_args ) {
if ( ‘example-module’ == $query_args[‘settings’]->id ) {
$query_args[‘post_type’] = array( ‘post’, ‘product’ );
}
return $query_args;
}
add_filter( ‘fl_builder_loop_query_args’, ‘fl_builder_loop_query_args_filter’ );
But I’m not sure how to use one or the other or both correctly to make it work. thank you for any insight!!