Event Capacity if No Tickets

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

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

    Hi,

    I have added some code to show the ‘Event Capacity and the No. of Tickets Left’ into the
    event-meta-event-single.php so that it shows in the single Event Details.
    However, some of our events do not require registration and a ticket. In this case the Capacity shows 0 and Event
    as Full.

    Is there an IF/ELSE statement addition I can make to the code to show ‘Registration Not
    Required’ if there is no ticket added to the Event?

    This is the code that I added to the php file.

        <!-- Show the capacity and available tickets -->
        
  • <?php $capacity = eo_get_event_capacity( get_the_ID() ); {printf('Capacity: %d , ', $capacity);} $remaining = eo_get_remaining_tickets_count( get_the_ID() ); if( $remaining > 1 ){printf( '%d tickets still available!', $remaining );}elseif ( $remaining == 1 ) {echo 'Only one ticket left!';}else{echo 'Sorry, event full!';}?>
  • Lorie

    Lorie Travis
    #27015

    You can use eo_get_event_tickets() (codex)

    if ( eo_get_event_tickets( get_the_ID() ) ) {
     //...
    }
    

    It returns the tickets created for the event.

    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.