WordPress.org

Forums

Events Manager
[resolved] Events Manager plugin only show events with bookable spaces available (3 posts)

  1. madmaia
    Member
    Posted 1 year ago #

    I have a php function to display events in a particular category, but I only want to output events that still have bookable places - the equivalent of the "has_spaces" conditional shortcode. Is there are method for $EM_Events that tests for this? I can't find any documentation.

    https://wordpress.org/plugins/events-manager/

  2. caimin_nwl
    NetWebLogic Support
    Posted 1 year ago #

    You can use conditional placeholders within the output string by including them under 'format'. Something like this:

    echo EM_Events::output( array( 'format'=>'{has_spaces}something here{/has_location}') );

  3. madmaia
    Member
    Posted 1 year ago #

    Goodness, I didn't know that, thank you! In the end I fixed it by delving in to the plugin code and finding methods, so I have

    $bookings = $EM_Event->get_bookings();
    if (($bookings->is_open()) && (($bookings->get_available_spaces()) > 0)) {
    $bookable_events[] = $EM_Event;
    }

    But I will make a note of that, it will be really useful, thank you!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Events Manager
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.