Hype5 Theater 0.6.17 · Pre-release

Hooks and filters

On this page

Hype5 Theater exposes WordPress actions and filters for presentation (templates, views, sections, layouts, labels, vocabularies), extension discovery and a few integration points. The Hype5 app additionally fires actions after its saves. This page lists every hook found in the plugin code with its arguments. Filters must return their first argument (or a value of the same type); a filter that returns the wrong type is ignored where the code checks for an array.

Presentation filters

Filter Arguments Purpose
hype5/theater/templates array $entries The template registry: key => ['key', 'path', 'version', 'public']. Add templates here. See Template overrides.
hype5/theater/template/candidates array $paths, string $key Existing candidate files for a public template, in lookup order (child theme, parent theme, plugin). Only paths from the original list are accepted.
hype5/theater/template/located string $path, string $key The chosen file. Only a path from the candidate list is accepted.
hype5/theater/view/{type} array $view, array $display Prepared data before a template renders. Types: production, person, performance, collection/productions, collection/people, collection/schedule. production and person views carry component (for example production.hero).
hype5/theater/production/sections, hype5/theater/person/sections array $entries Section definitions of the single page. See Add-ons.
hype5/theater/layouts/{family} array $entries Layout variants of a family. See Add-ons.
hype5/theater/labels array $entries Public text definitions: key => ['default', 'group', 'common']. See Labels.
hype5/theater/label-presets array $presets Named sets of label overrides (theatre, dance, opera, custom).
hype5/theater/vocabulary/{family} array $values Content-type options key => label for visitor, partner, article, accessibility.

View data and display arrays are documented per template in Template overrides. Values in a view are prepared for output; keep the documented fields and escape anything you add.

Presentation actions

Action Arguments When
hype5/theater/render/before, hype5/theater/render/after string $key, array $view, array $display Around every template render, inside the output buffer: echoed markup becomes part of the output.
hype5/theater/production/section/before, .../after string $section, array $view, array $display Around each production section on the single page. $view has id and context (single). Echoed markup is placed before/after the section.
hype5/theater/person/section/before, .../after same Around each person section.

Sections of a password-protected production are not rendered until the password is entered, so these actions do not fire for them.

Extension and integration hooks

Hook Type Arguments Purpose
hype5_addons filter array $manifests, string $host ('theater') Register an add-on manifest. See Add-ons.
hype5/theater/ready action array ['version' => string, 'host' => 'theater'] Fired on init (priority 30) after add-on discovery.
hype5t_use_theme_single_template filter bool $use = false, int $queried_id Return true to keep the theme's single template when the clean single templates setting is on.
hype5t_image_credit filter string $name, int $attachment_id Photographer credit of an image (Hype5 photographer field, else the image's IPTC credit).
hype5t_elab_profile_url filter string $url, string $entity, int $elab_id ELAB link built from a numeric ID. $entity is lavastus (production) or inimene (person).
hype5t_classic_inserter_post_types filter array $types = ['post', 'page'] Post types whose Classic Editor shows Insert Hype5 content.
hype5_theater_fuajee_enabled filter bool $enabled, int $user_id Grant or veto access to the Hype5 app per user (and with it the single Hype5 Theater menu entry). Never grants capabilities.

Hype5 app actions

These actions fire only after a successful save in the Hype5 app. Saves on the classic screens, WP-CLI or other code do not fire them; use WordPress's own hooks (save_post, edited_term and so on) for those. They are not yet classified as stable (class Provisional) and may change. An exception thrown by a listener is logged and does not turn a completed save into a failure.

Action Arguments
hype5_theater_production_created int $id, array $owners
hype5_theater_person_created int $id, array $owners
hype5_theater_venue_created int $id, array $owners
hype5_theater_story_saved int $production_id, array $owners
hype5_theater_content_saved int $production_id, array $owners (media, visitor information, links, display)
hype5_theater_credits_saved int $production_id, array $owners
hype5_theater_publishing_saved int $post_id, array $owner, array $before
hype5_theater_person_saved int $person_id, array $owners
hype5_theater_venue_saved int $venue_id, array $owners
hype5_theater_production_modified, hype5_theater_person_modified, hype5_theater_venue_modified int $post_id, array $owners, bool $post_row_written
hype5_theater_people_bulk, hype5_theater_venues_bulk string $action, array $results (only the records that changed)
hype5_theater_performance_saved int $performance_id, array $changed_groups
hype5_theater_performances_created array $ids, string $mode
hype5_theater_performances_bulk array $ids, string $action, int $venue_id
hype5_theater_vocabulary_saved string $family (content-type option lists only)
hype5_theater_settings_saved string $group, array $keys
hype5_theater_appearance_saved string $area, array $owners

$owners describes which parts of the record were written (for example post, meta, terms, image) with their outcome. The *_modified actions accompany substantive saves of a production, person or venue, including saves that write only meta, terms or credits.

Example

add_filter('hype5/theater/view/production', function (array $view, array $display): array {
    if (($view['component'] ?? '') === 'production.hero') {
        $view['subtitle'] = get_post_meta((int) $view['id'], 'my_subtitle', true);
    }
    return $view;
}, 10, 2);