Change style/color for soldout Event

WordPress Event Management, Calendars & Registration Forums General Question Change style/color for soldout Event

This topic contains 1 reply, has 2 voices, and was last updated by  Stephen Harris 3 years, 7 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #39752

    Hello,

    Is there a way to change color for sold out event in th month view?
    Or add a class to style it?
    Thank’s for your answer
    Best Vince

    Vincent
    #39772

    Hi Vince,

    There is a filter for adding HTML classes to the events in the calendar. However, the calendar is cached, so you’d want to clear that cache each time a booking is made as it might impact whether the event is sold out or not.

    The following does that:

    add_filter( 'eventorganiser_event_classes', function( $event_classes, $event_id, $occurrence_id ){
    
        $remaining = eo_get_remaining_tickets_count( $event_id, $occurrence_id );
        if ( $remaining === 0 ) {
            $event_classes[] = "sold-out";
        }
        //Change first value and return it
        return $event_classes;
    }, 10, 3 );
    
    add_action('eventorganiser_transition_booking_status', function(){
        delete_transient( 'eo_full_calendar_public' );
        delete_transient( 'eo_full_calendar_public_priv' );
    });
    

    Note: it adds the sold-out class to any event without any available tickets. I.e. it includes past events and events without any tickets.

    Stephen Harris
Viewing 2 posts - 1 through 2 (of 2 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.