• Resolved paintandpour

    (@paintandpour)


    I am using Advanced Post Manager with the Events Calendar, and in general it works wonderfully. However, I can’t seem to find a way to set a filter to show a list of events from today onward. For example, I would like:

    Filter: Start Date > On or After > Today

    As it is now, I have to manually set and update the date to keep old events from populating. Every day. For every filter. Which is a lot, if you use filters as much as I do.

    Is there a way to set and forget this, so it only shows events that are generally relevant?

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support masoodak

    (@masoodak)

    Hi @paintandpour,

    Thanks for reaching out!

    Unfortunately, it is not possible to set Start Date filter to a dynamic value, like Today, with default functionality of the plugin.

    One workaround in this regard would be to filter out past events from admin views using pre_get_posts hook. For example, something like this should work,

    function tec_admin_events_start_date_now_onwards( $query ) {
    	
    	if ( is_admin() && in_array ( $query->get('post_type'), array('tribe_events') ) ) {
    		$now = date("Y-m-d H:i", strtotime('now'));
            $query->set( 'meta_query', array(
                array(
                    'key' => '_EventStartDate',
                    'compare' => '>=',
                    'value' => $now,
                    'type' => 'DATE'
                )
            ));
    	}
    }
    add_action( 'pre_get_posts', 'tec_admin_events_start_date_now_onwards' );

    Try adding this snippet in functions.php file of your theme and see if this helps.

    Kind regards,
    Masood

    Hi there!

    This thread has been inactive for a while so I’ll be marking it as Resolved.

    Please feel free to open a new thread if any other questions come up and we’d be happy to help.

    Best regards,

    Marho

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Way to set “today” for saved filters’ is closed to new replies.