Display monthly class schedule customization?

WordPress Event Management, Calendars & Registration Forums General Question Display monthly class schedule customization?

This topic contains 3 replies, has 2 voices, and was last updated by  Stephen Harris 5 years ago.

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

    How can I modify the displayed Monthly class schedule widget
    [eo_fullcalendar]

    I want to added to the displayed text so it says “CLOSED” on the end when it’s past it’s date and also say “CLASS FULL” when the class is fully booked.

    Thanks for any help.

    Chris Christenson
    #33679

    Hi Chris,

    Something like this should work:

    function my_mark_event_as_booked( $event, $event_id, $occurrence_id ){
    
        $now = new \DateTime();
    
        if ( eo_get_the_start(DATETIMEOBJ, $event_id, $occurrence_id) < $now ) {
            $event['title']      = $event['title'] . " (Closed)"; //change title (optional!)
            $event['description'] = "<strong>Closed.</strong> <br>" . $event['description']; //change tooltip content (optional!)
            return $event;
        }
    
        //Check if the event has tickets
        if( eo_get_event_tickets( $event_id ) ){
    
            //Check if the event has any tickets remaining
            if( eventorganiser_pro_get_option( 'book_series' ) ){
                $remaining = eo_get_remaining_tickets_count( $event_id );
            }else{
                $remaining = eo_get_remaining_tickets_count( $event_id, $occurrence_id );
            }
    
            if( 0 == $remaining ){
                $event['title']      = $event['title'] . " (Fully booked)"; //change title (optional!)
                $event['description'] = "<strong>Fully booked.</strong> <br>" . $event['description']; //change tooltip content (optional!)
            }
        }
    
        return $event;
    
    }
    add_filter( 'eventorganiser_fullcalendar_event', 'my_mark_event_as_booked', 10, 3 );
    

    The calendar is cached, so you’ll need to disable that:

    // Disable caching
    add_filter( 'pre_transient_eo_full_calendar_public', '__return_null');
    
    Stephen Harris
    #33686

    Where do I put this code?
    Thanks for the help

    Chris Christenson
    #33818

    Ideally in a utility plugin. But it would also work in a theme/child-theme’s functions.php: https://wp-event-organiser.com/blog/tutorial/where-should-i-put-code-from-the-tutorials/

    Stephen Harris
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.