Restrict previous months on calendar shortcode

WordPress Event Management, Calendars & Registration Forums General Question Restrict previous months on calendar shortcode

This topic contains 3 replies, has 2 voices, and was last updated by  Susie Brew 1 year, 6 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #41856

    Hi
    We use the following shortcode to display the calendar:
    [eo_fullcalendar headerCenter=’month,agendaWeek]

    Is it possible to restrict the display so that the user can’t go backwards to previous months – so that they can only see the current month and future months?

    Thank you.

    Susie Brew
    #41884

    Hi – I wondered if you had had a chance to look at this? Many thanks. Susie

    Susie Brew
    #41944

    Hi Susie,

    Apologies for the delay in getting back to you.

    This isn’t possible, but it would be possible to filter out the past events:

    <?php
        add_filter( 'eventorganiser_fullcalendar_query', function($query){
    
            $start = new DateTime($query['event_end_after']);
            $now = new DateTime();
            if ($start < $now) {
                $query['event_end_after'] = $now->format('Y-m-d');
            }
            return $query;
        } );
    
        //Disable caching
        add_filter('eo_full_calendar_public', '__return_false');
        add_filter('eo_full_calendar_public_priv', '__return_false');
    
    Stephen Harris
    #41948

    Thanks Stephen – that’s not quite what I was looking for, but thank you for the information. I’ll have a think. Best wishes Susie

    Susie Brew
Viewing 4 posts - 1 through 4 (of 4 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.