Theater for WordPress Code Reference
  • Package
  • Class

Packages

  • Theater
    • Abstracts
    • Events

Classes

  • Theater_Event
  • Theater_Event_Date
  • Theater_Event_Date_Link
  • Theater_Event_Date_List
  • Theater_Event_Field
  • Theater_Event_List

Class Theater_Event

Handles individual events.

An event can have one or more event dates.

Usage

// Output an event as HTML.
$event = new Theater_Event( 123 );
echo $event;
// Output an event as HTML with a custom template:
$event = new Theater_Event( 123, '{{title}}{{dates}}{{location}}' );
echo $event;
// Get the value of an event field:
$event = new Theater_Event( 123 );
$dates = $event->dates(); // Eg. '05-06-2017'.
$prices = $event->prices(); // An array of all ticket prices for this date.
$title = $event->title(); // Eg. 'Sound of Music'.
// Output the value of an event date field as HTML:
$event = new Theater_Event( 123 );
echo $event->dates;
echo $event->prices;
echo $event->title;

Fields

Events have the following fields:

field description
categories The categories of the event.
cities A summary of all the cities that the event takes place.
content The post content of the event.
dates A summary of all the dates of the event.
excerpt The excerpt of the event.
summary A summary of the event.
permalink The permalink of the event.
title The title of the event.
thumbnail The thumbnail image of the event.

HTML template

The default template for the HTML output of an event date is: {{thumbnail|permalink}} {{title|permalink}} {{dates}} {{cities}}

Theater_Item
Extended by Theater_Event
Package: Theater\Events
Since: 0.16
Located at functions/event/class-theater-event.php

Methods summary

public array
# get_fields( )

Gets a list of of available fields for this item.

Gets a list of of available fields for this item.

Returns

array

Since

0.16
public Theater_Event_Date[]
# get_event_dates( array $filters = array() )

Gets the event dates of an event.

Gets the event dates of an event.

Parameters

$filters

An array of filter arguments. Optional. See Theater_Event_Date_List::get() for possible filter arguments.

Returns

Theater_Event_Date[]
The event dates of an event.

Since

0.16

Uses

Theater_Event_Date_List::get()
to get the event dates of an event.
public string
# get_html( string $template = '' )

Gets the HTML for an event.

Gets the HTML for an event.

Parameters

$template
The template for the event HTML.

Returns

string
The HTML for an event.

Since

0.4
0.10.8 Added a filter to the default template.
0.14.7 Added the $args parameter.
0.15.2 Removed the $args parameter.

Methods inherited from Theater_Item

__construct(), apply_template_filters(), get_field(), get_field_html(), get_name(), get_post_type(), has_field()

Constants summary

string name
# 'event'
string post_type_name
# 'wp_theatre_prod'

Properties summary

Properties inherited from Theater_Item

$ID

Theater for WordPress Code Reference API documentation generated by ApiGen