eo_get_bookings
since 1.1
Pro
eo_get_bookings( $args = array() )
A wrapper for `get_posts()` to retrieve bookings
This function queries the booking and returns the matching bookings as an array (via get_posts()
)
Accepts the following arguments:
- status - the status of the bookings (e.g.
any
,confirmed
,pending
).
- event_id - Get bookings for this event (post ID)
- occurrence_id - Get bookings for this occurrence (occurrence ID)
- bookee_id - Get bookings by user (ID)
- booking_id - Get a particular booking by ID
- numberposts - The number of bookings to return
- orderby - How to order by the bookings 'date', 'ID', 'price'. Default 'date'.
- order - ASC | DESC
- offset The number of bookings to offset by in the query
Example
Displays a list of confirmed bookings for event with ID 1986 and date with ID 2334.
$bookings = eo_get_bookings( array(
'status'=>'confirmed',
'event_id' => 1986,
'occurrence_id' => 2334,
) );
if( $bookings ){
echo '<ul>';
foreach( $bookings as $booking ){
printf(
'<li> %1$s booked %2$s places for %3$s </li>',
eo_get_booking_meta( $booking->ID, 'bookee_display_name' ),
eo_get_booking_meta( $booking->ID, 'ticket_quantity' ),
get_the_title( eo_get_booking_meta( $booking->ID, 'event_id' ) )
);
}
echo '</ul>';
}
Parameters
array
|
$args = array() |
Array containing submission data
|
Return value
array
|
Array of booking (post) objects matching criteria
|
Changelog