{"id":5058,"date":"2026-04-24T12:38:43","date_gmt":"2026-04-24T10:38:43","guid":{"rendered":"https:\/\/cevento-plugin.com\/docs\/001-events\/"},"modified":"2026-04-24T12:38:43","modified_gmt":"2026-04-24T10:38:43","slug":"001-events","status":"publish","type":"docs","link":"https:\/\/cevento-plugin.com\/en\/docs\/001-events\/","title":{"rendered":"Event Model"},"content":{"rendered":"\n<p>To retrieve information about an event, you can use the model class <code>Cevento\\Models\\Event<\/code>.<br>\nThis class provides various static helper methods for database queries.<\/p>\n<h2 id=\"event-query\">Event Query<\/h2>\n<p>A single event can be retrieved with the following method:<\/p>\n<pre><code class=\"language-php\">$event = Cevento\\Models\\Event::get($event_id);<\/code><\/pre>\n<p>To query multiple events, you can use the following method:<\/p>\n<pre><code class=\"language-php\">$events = Cevento\\Models\\Event::getAll($query_args = []);<\/code><\/pre>\n<p>Additional filter and sort parameters can be passed via the <code>$query_args<\/code> array.<br>\nIt expects the standard structure of the parameter for the method <code>WP_Query::parse_query($query_args)<\/code>.<br>\nA full overview of all possible parameters can be found in the <a href=\"https:\/\/developer.wordpress.org\/reference\/classes\/wp_query\/#parameters\" rel=\"noopener\">official WordPress documentation<\/a>.<\/p>\n<h2 id=\"event-data-structure\">Event Data Structure<\/h2>\n<p>Events are returned as associative arrays with the following structure:<\/p>\n<div class=\"uk-overflow-auto\">\n<table>\n<thead>\n<tr>\n<th>Key<\/th>\n<th>Type<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>id<\/td>\n<td>Integer<\/td>\n<td>The ID of the event<\/td>\n<\/tr>\n<tr>\n<td>title<\/td>\n<td>String<\/td>\n<td>The name of the event<\/td>\n<\/tr>\n<tr>\n<td>description<\/td>\n<td>String<\/td>\n<td>The unformatted description of the event<\/td>\n<\/tr>\n<tr>\n<td>html_description<\/td>\n<td>String<\/td>\n<td>The formatted description of the event<\/td>\n<\/tr>\n<tr>\n<td>fullday<\/td>\n<td>Boolean<\/td>\n<td>Whether the event is all-day<\/td>\n<\/tr>\n<tr>\n<td>createdAt<\/td>\n<td>DateTime<\/td>\n<td>Event creation date<\/td>\n<\/tr>\n<tr>\n<td>startsAt<\/td>\n<td>DateTime<\/td>\n<td>Event start date and time<\/td>\n<\/tr>\n<tr>\n<td>endsAt<\/td>\n<td>DateTime<\/td>\n<td>Event end date and time<\/td>\n<\/tr>\n<tr>\n<td>bookingEnabled<\/td>\n<td>Boolean<\/td>\n<td>Whether bookings for this event are enabled in the backend. <strong>Note:<\/strong> This only refers to the checkbox setting in the event and does not consider available spots or the defined booking period.<\/td>\n<\/tr>\n<tr>\n<td>bookingForm<\/td>\n<td>Integer, Null<\/td>\n<td>The ID of the linked booking form<\/td>\n<\/tr>\n<tr>\n<td>bookingMaxPlaces<\/td>\n<td>Integer<\/td>\n<td>The maximum number of available spots<\/td>\n<\/tr>\n<tr>\n<td>bookingStartsAt<\/td>\n<td>DateTime<\/td>\n<td>Date and time when bookings open<\/td>\n<\/tr>\n<tr>\n<td>bookingEndsAt<\/td>\n<td>DateTime<\/td>\n<td>Date and time when bookings close<\/td>\n<\/tr>\n<tr>\n<td>address<\/td>\n<td>String<\/td>\n<td>The event address<\/td>\n<\/tr>\n<tr>\n<td>addressName<\/td>\n<td>String<\/td>\n<td>The label\/name of the event location<\/td>\n<\/tr>\n<tr>\n<td>coordinates<\/td>\n<td>String<\/td>\n<td>The coordinates of the event location (lat,lng)<\/td>\n<\/tr>\n<tr>\n<td>bookingConfirmationRequired<\/td>\n<td>Boolean<\/td>\n<td>Whether a booking must be confirmed by an administrator<\/td>\n<\/tr>\n<tr>\n<td>categories<\/td>\n<td>Array<\/td>\n<td>All categories linked to the event<\/td>\n<\/tr>\n<tr>\n<td>url<\/td>\n<td>String<\/td>\n<td>The link to the single event view<\/td>\n<\/tr>\n<tr>\n<td>status<\/td>\n<td>String<\/td>\n<td>The current publication status of the event<\/td>\n<\/tr>\n<tr>\n<td>dateTime<\/td>\n<td>String<\/td>\n<td>Formatted time interval of the event<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h2 id=\"additional-methods\">Additional Methods<\/h2>\n<h3>Metadata Queries<\/h3>\n<pre><code class=\"language-php\">use \\Cevento\\Models\\Event;\n\n\/\/ Checks if an event is in the future\nEvent::isUpcoming($event_id): bool\n\n\/\/ Returns the formatted time period of an event\nEvent::getDateTime($event_id): string<\/code><\/pre>\n<h3>Booking Queries<\/h3>\n<pre><code class=\"language-php\">use \\Cevento\\Models\\Event;\n\n\/\/ Checks if bookings are active for an event\nEvent::isBookingActive($event_id): bool \n\n\/\/ Checks if there are still available spots for the event\nEvent::hasPlacesAvailable($event_id): bool \n\n\/\/ Checks if an event is fully booked\nEvent::isFull($event_id): bool \n\n\/\/ Returns the number of available spots\nEvent::getAvailablePlaces($event_id): int \n\n\/\/ Returns the availability status as a formatted string\nEvent::getAvailablePlacesText($event_id): string<\/code><\/pre>\n\n","protected":false},"featured_media":0,"parent":0,"template":"","meta":{"_acf_changed":false},"thema":[682],"class_list":["post-5058","docs","type-docs","status-publish","hentry","thema-development"],"acf":{"excerpt":"Event Data Structure & Methods","toc":"<ol class=\"toc\">\n<li><a href=\"#event-query\"  uk-scroll=\"offset: 120\">Event Query<\/a><\/li>\n<li><a href=\"#event-data-structure\"  uk-scroll=\"offset: 120\">Event Data Structure<\/a><\/li>\n<li><a href=\"#additional-methods\"  uk-scroll=\"offset: 120\">Additional Methods<\/a><\/li>\n<\/ol>\n"},"_links":{"self":[{"href":"https:\/\/cevento-plugin.com\/en\/wp-json\/wp\/v2\/docs\/5058","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cevento-plugin.com\/en\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/cevento-plugin.com\/en\/wp-json\/wp\/v2\/types\/docs"}],"wp:attachment":[{"href":"https:\/\/cevento-plugin.com\/en\/wp-json\/wp\/v2\/media?parent=5058"}],"wp:term":[{"taxonomy":"thema","embeddable":true,"href":"https:\/\/cevento-plugin.com\/en\/wp-json\/wp\/v2\/thema?post=5058"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}