Display posts from today and future in Elementor ‘posts widget’

Question

According to Elementor documentation https://developers.elementor.com/custom-query-filter/#Multiple_Post_Types_in_Posts_Widget

I need to display future posts including the post from today. We want to display places and dates where a rock band will be (we don’t want to display posts with date before today)

I am using this code:

add_action( 'elementor/query/my_custom_filter', function( $query ) {    
    $meta_query = $query->get( 'meta_query' );
    $meta_query[] = [       
        'post_status' => 'publish,future',
        'order' => 'ASC',
        'posts_per_page' => 3,
        'date_query' => array(
            array(
                'after' => date('Y-m-d'),
                'inclusive' => true,
            )
        ),    
    ];
    $query->set( 'meta_query', $meta_query );   
});

but it does not work.

How would you do it?

0
, Estacion Visual 3 years 2020-05-31T06:10:51-05:00 0 Answers 75 views 0

Leave an answer

Browse
Browse