Documentation
In this documentation, you will find all the important information about the plugin – from installation and configuration to usage and extension.
Event Model
In this post, we’ll walk you through:
To retrieve information about an event, you can use the model class Cevento\Models\Event.
This class provides various static helper methods for database queries.
Event Query
A single event can be retrieved with the following method:
$event = Cevento\Models\Event::get($event_id);To query multiple events, you can use the following method:
$events = Cevento\Models\Event::getAll($query_args = []);Additional filter and sort parameters can be passed via the $query_args array.
It expects the standard structure of the parameter for the method WP_Query::parse_query($query_args).
A full overview of all possible parameters can be found in the official WordPress documentation.
Event Data Structure
Events are returned as associative arrays with the following structure:
| Key | Type | Description |
|---|---|---|
| id | Integer | The ID of the event |
| title | String | The name of the event |
| description | String | The unformatted description of the event |
| html_description | String | The formatted description of the event |
| fullday | Boolean | Whether the event is all-day |
| createdAt | DateTime | Event creation date |
| startsAt | DateTime | Event start date and time |
| endsAt | DateTime | Event end date and time |
| bookingEnabled | Boolean | Whether bookings for this event are enabled in the backend. Note: This only refers to the checkbox setting in the event and does not consider available spots or the defined booking period. |
| bookingForm | Integer, Null | The ID of the linked booking form |
| bookingMaxPlaces | Integer | The maximum number of available spots |
| bookingStartsAt | DateTime | Date and time when bookings open |
| bookingEndsAt | DateTime | Date and time when bookings close |
| address | String | The event address |
| addressName | String | The label/name of the event location |
| coordinates | String | The coordinates of the event location (lat,lng) |
| bookingConfirmationRequired | Boolean | Whether a booking must be confirmed by an administrator |
| categories | Array | All categories linked to the event |
| url | String | The link to the single event view |
| status | String | The current publication status of the event |
| dateTime | String | Formatted time interval of the event |
Additional Methods
Metadata Queries
use \Cevento\Models\Event;
// Checks if an event is in the future
Event::isUpcoming($event_id): bool
// Returns the formatted time period of an event
Event::getDateTime($event_id): stringBooking Queries
use \Cevento\Models\Event;
// Checks if bookings are active for an event
Event::isBookingActive($event_id): bool
// Checks if there are still available spots for the event
Event::hasPlacesAvailable($event_id): bool
// Checks if an event is fully booked
Event::isFull($event_id): bool
// Returns the number of available spots
Event::getAvailablePlaces($event_id): int
// Returns the availability status as a formatted string
Event::getAvailablePlacesText($event_id): string