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_List

Handles event lists.

Use this class to get an array of events or a fully formatted HTML list of events.

Basic usage

// Retrieve a list of all events.
$events = new Theater_Event_List;
foreach ( $events() as $event ) {
    // $event is a Theater_Event object.
    echo $event->title();
}
// Output a formatted list of all events.
$events = new Theater_Event_List;
echo $events;

Filtered lists

You can pass extra filter arguments to customize the events that are in the list:

// Retrieve a list of events with upcoming dates.
$events = new Theater_Event_List( array( 'start' => 'now' ) );

See Theater_Event_List::get() for a full list of accepted arguments.

Customized output

You can also formatting arguments to customize the HTML output of the list:

// Retrieve a list of events with upcoming dates.
$dates = new Theater_Event_List( array( 'start' => 'now' ) );

See Theater_Event_List::get_html() for a full list of accepted arguments.

Theater_List
Extended by Theater_Event_List
Package: Theater\Events
Since: 0.5
Since: 0.10 Complete rewrite, while maintaining backwards compatibility.
Located at functions/event/class-theater-event-list.php

Methods summary

public array
# get_categories( array $filters )

Gets all categories with productions.

Gets all categories with productions.

Parameters

$filters
See WPT_Productions::get() for possible values.

Returns

array
The categories.

Since

0.5
0.10 Renamed method from categories() to get_categories().
0.10.2 Now returns the slug instead of the term_id as the array keys.
0.10.14 Significally decreased the number of queries used.

0.13.3 Now uses the production filters. Added filters to manipulate the categories.


protected array
# get_classes_for_html( array $args = array() )

Gets the CSS classes for a production listing.

Gets the CSS classes for a production listing.

Parameters

$args
See WPT_Productions::get_html() for possible values. Default: array().

Returns

array
The CSS classes.

Since

0.10
0.14.7 Added $args to parent::get_classes_for_html().

See

WPT_Listing::get_classes_for_html()

Overrides

Theater_List::get_classes_for_html
protected string
# get_html_for_page( array $args = array() )

Gets a list of productions in HTML for a page.

Gets a list of productions in HTML for a page.

Parameters

$args
See WPT_Productions::get_html() for possible values.

Returns

string
The HTML.

Since

0.10
0.13 Added support for days, months and years.

See

WPT_Productions::get_html_grouped();
WPT_Productions::get_html_for_season();
WPT_Productions::get_html_for_category();

Overrides

Theater_List::get_html_for_page
public string
# get_html( array $args = array() )

Gets a fully formatted listing of productions in HTML.

Gets a fully formatted listing of productions in HTML.

The list of productions is compiled using filter-arguments that are part of $args. See WPT_Productions::get() for possible values.

The productions can be shown on a single page or be cut up into multiple pages by setting $paginateby. If $paginateby is set then a page navigation is added to the top of the listing.

The productions can be grouped inside the pages by setting $groupby.

Parameters

$args

{ An array of arguments. Optional.

These can be any of the arguments used in the $filters of WPT_Productions::get(), plus:

Returns

string
A fully formatted listing of productions in HTML.

Since

0.5

0.10 Moved parts of this method to seperate reusable methods. Renamed method from html() to get_html(). Rewrote documentation.


See

WPT_Listing::get_html()
WPT_Productions::get_html_pagination()
WPT_Productions::get_html_for_page()

WPT_Productions::get_html_pagination() for possible values. Default <[]>.


WPT_Productions::get_html_grouped() for possible values. Default .


Type

array $paginateby Fields to paginate the listing by.
string $groupby Field to group the listing by.

string $template Template to use for the individual productions. Default . }


Overrides

Theater_List::get_html
public array
# get_pagination_filters( )

Gets the pagination filters for a production listing.

Gets the pagination filters for a production listing.

Returns

array
The pagination filters for a production listing.

Since

0.13.4

Overrides

Theater_List::get_pagination_filters
protected string
# get_html_page_navigation( array $args = array() )

Gets the page navigation for an event listing in HTML.

Gets the page navigation for an event listing in HTML.

Parameters

$args

The arguments being used for the event listing. See WPT_Events::get_html() for possible values.

Returns

string
The HTML for the page navigation.

Since

0.10
0.13 Added support for days, months and years.

0.13.4 Show the pagination filters in the same order as the the 'paginateby' argument.


See

WPT_Listing::filter_pagination()
WPT_Events::get_days()
WPT_Events::get_months()
WPT_Events::get_categories()

Overrides

Theater_List::get_html_page_navigation
public array
# get_seasons( array $filters,… )

Gets an array of all categories with productions.

Gets an array of all categories with productions.

Parameters

$filters,…
See WPT_Productions::get() for possible values.

Returns

array
An array of WPT_Season objects.

Since

Unknown
0.10 Renamed method from seasons() to get_seasons().
public WPT_Production[]
# get( array $filters = array() )

Gets a list of productions.

Gets a list of productions.

Parameters

$filters

$args { string $order. See WP_Query. int $season. Only return productions that are linked to $season. int $limit. See WP_Query. $post__in. See WP_Query. $post__not_in. See WP_Query. $cat. See WP_Query. $category_name. See WP_Query. category__and. See WP_Query. category__in. See WP_Query. category__not_in. See WP_Query. ignore_sticky_posts. See WP_Query. }

Returns

WPT_Production[]
An array of WPT_Production objects.

Since

0.5

0.10 Renamed method from load() to get(). Added 'order' to $args.


0.13 Support for 'start' and 'end'.

0.14.2 Fixed a conflict when using 'start' and 'post__not_in' together. See #183.


0.15 Added support for 's' (keyword search).

Overrides

Theater_List::get
public
# categories( $filters = array() )

Deprecated

0.10

See

WPT_Productions::get_categories()
public
# seasons( $filters = array() )

Deprecated

0.10

See

WPT_Productions::get_seasons()

Methods inherited from Theater_List

__construct(), __invoke(), __toString(), add_query_vars(), filter_pagination()

Properties summary

Properties inherited from Theater_List

$default_args, $default_args_for_html

Theater for WordPress Code Reference API documentation generated by ApiGen