Hype5 Theater 0.7.0 · Beta — by invitation
Labels (public texts)
Labels are the public texts of Hype5 output — headings, button texts, filter names, status words and built-in vocabulary names. Each has a stable key and a translated default, and administrators can override it per language in Appearance → Text (classic: Appearance → Text & Labels). Themes and add-ons read labels through one function and can register their own.
Reading a label
use Hype5\Theater\Frontend\Labels;
echo esc_html(Labels::get('production.premiere'));
Labels::get(string $key, ?string $locale = null): string returns, in order: the override for the given locale (default: the current locale), the override for the site language, the translated default. An unknown key returns an empty string. The value is plain text: escape it at output.
Labels::all() returns every definition: key => ['default' => string, 'group' => string, 'common' => bool]. Use it as the key catalogue.
Key families
| Prefix | Examples |
|---|---|
production. |
premiere, duration, language, audience, premiere_venue, cast, creative, team, technical, thanks, introduction |
person. |
born, professions, biography, current_productions, past_productions, from_production, other_productions |
schedule. |
title, past, no_upcoming, no_past, date, venue, replacement, other_locations |
tickets. |
buy, from, available, sold_out, closed, unknown, title |
status. |
scheduled, sold_out, cancelled, postponed |
collection. |
productions, people, schedule, current, upcoming, archive, result, results, historical_audience |
filter., company., pagination., empty. |
collection filter bar, company relationship, pagination and empty states |
gallery., media., visitor., links., articles., partners. |
section headings and item labels |
layout.{family}.{variant} |
layout names shown in Appearance |
event.{key}, service.{key} |
performance events and services |
vocabulary.{family}.{key} |
built-in content-type names (visitor, partner, article, accessibility) |
collection.result and collection.results contain %d; keep the placeholder in overrides. A count of one uses the singular, every other count the plural.
Groups (used to organise the Text area): general, productions, people, schedule, tickets, media, visitor.
Registering a label
add_filter('hype5/theater/labels', function (array $labels): array {
$labels['education.materials'] = [
'default' => __('Learning materials', 'my-addon'),
'group' => 'general',
'common' => false,
];
return $labels;
});
Use stable keys that do not depend on the translated text, and keep user content out of defaults. Registered labels appear in the Text area and can be overridden like built-in ones.
Presets
Labels::presets() returns named override sets — theatre, dance (for example Dancers for the cast heading), opera (Singers), custom — filterable with hype5/theater/label-presets.
Storage and updates
Overrides are stored in the option hype5t_labels as locale => [key => text], at most 500 characters per text. Labels::update(array $stored, string $locale, array $input, ?string $resetGroup = null): array returns a cleaned new map without writing it: an empty value removes that locale's override, and $resetGroup removes all overrides of one group. Writing the option is the caller's responsibility.
Labels change only public texts. Administration texts use normal translations, and content such as ticket-offer labels, custom vocabulary names and article titles is never a label.