class \WP_Stager_Integration\Event {}
class \WP_Stager_Integration\Event {}Description
Main class used to interact with Stager events, and render event components.
Information
| File | class-event.php line 14 |
|---|
Constants
| Constant | Type | Value | Description |
|---|---|---|---|
CPT_SLUG | string | wpstager_event | The post type slug of the custom post type used to store Stager events. |
Methods
| Method | Description |
|---|---|
| filter_canonical_url() | Filters the canonical URL to use the correct event permalink structure. |
| filter_event_content() | Filters event post content. |
| filter_event_date() | Filters the event date. |
| generate_structured_data() | Generates structured data (Schema.org JSON-LD) for an event. |
| get_additional_images() | Gets additional gallery images from event media. Prefers additionalImages objects; falls back to deprecated additionalImageUrls. |
| get_all_events() | Gets all events. When $include_past is false, only returns upcoming events. |
| get_currently_happening_events() | Gets currently happening (ongoing) events, i.e. events whose start dates are in the past and end dates are in the future. |
| get_event_by_id() | Gets a single Stager event by its event ID. |
| get_event_post_by_id() | Gets an event post object by its Stager event ID. |
| get_event_post_ids() | Gets all event post IDs, keyed by their Stager event IDs (integers). |
| get_events_by_day() | Gets events for a given day (including multi-day events overlapping that day). |
| get_events_within_date_range() | Gets events within a date range (raw Stager data). |
| get_main_image_alt() | Gets the main image alternative text from event media. Falls back to the event title ($event[ 'name' ]) if no alt text is provided. |
| get_main_image_url() | Gets the main image URL from event media. Loads data from the mainImage field, but falls back to the deprecated mainImageUrl field if not present. |
| get_past_events() | Gets past events. |
| get_permalink() | Gets the permalink URL for an event. |
| get_placeholder_data() | Get placeholder event data for block editor previews. This method returns a sample event data array that matches the structure returned by Event::get_single_event_data(). This is used to render previews in the block editor when no actual event data is available. |
| get_single_event_data() | Gets event data on a single event page or for the current post in the loop. Works on single event pages and when inside a loop where the current post (global $post) is a stager Event post object. Returns placeholder data in block editor preview mode. |
| get_single_event_id() | Gets the event ID of the currently viewed event page. |
| get_status_label() | Gets the status label for an event. |
| get_subtitle() | Gets the localized event subtitle. |
| get_text() | Gets the localized event text. |
| get_text_html() | Gets the localized event text as HTML. |
| get_todays_events() | Gets today's events. This method is a wrapper for \WP_Stager_Integration\Event::get_events_by_day(). |
| get_unfinished_events() | Gets events that have not ended yet, ordered by start ascending. Selects on the program end time rather than the start time, so an event that is running right now still counts as upcoming, while an event that finished earlier today does not. Events without a usable end timestamp fall back to their start time. |
| get_upcoming_events() | Gets upcoming events. |
| init() | Class initialization. |
| is_single_event() | Checks if the current query is for a single event page. |
| output_structured_data() | Outputs structured data as a JSON-LD script element. |
| parse_events() | Parses a list of raw Stager events: removes empty entries and runs the result through a filter. |
| redirect_default_event_url() | Redirects default event URL to chosen permalink structure. |
| resolve_event_permalinks() | Attempts to resolve event permalinks by parsing the URL and setting query vars. |
| return_404_for_hidden_statuses() | Return a 404 if the event has a hidden status. |
| update() | Upserts an event CPT object into the database. Updates the event CPT object if it already exists. Inserts it if it doesn't. |
💡 If you ever get stuck or have a question, please check our FAQs, our Free Integration Service, our paid Full Integration Service, or reach out to us!

Get WP Stager Integration
🎁 Limited offer: Use code WELCOME26 to get your first month for free!

