Restyle or reword the Explicit badge
The Explicit badge is rendered by one class — Benecaster\Episode\ExplicitBadgeRenderer — from every surface it appears on: the episode single page, archive cards, the [benecaster_episodes] list, the [benecaster_player] title strip, and the [benecaster_explicit_badge] shortcode. All of them share the same three filters, so a single hook changes the badge everywhere rather than needing a template override per surface.
Three asks come up repeatedly, and each maps to exactly one filter. Pick the smallest one that does the job.
“Change the wording.” Use the label filter. “E”, “18+”, “Adult”, your own phrasing — all one line, and the accessibility attributes and class modifiers stay intact.
“Restyle it.” Usually no PHP at all. The markup already carries --{mode} and --context-{surface} class modifiers, so CSS can style explicit differently from clean, and the archive grid differently from the single page. Reach for the HTML filter only when you need to change the structure — injecting an icon, say — not the appearance.
“Force it on for this one episode.” Use the mode filter. It overrides the resolved value without writing to the episode, which keeps a one-off out of your stored data.
Code
<?php
// 1. Replace "Explicit" with a short "E" everywhere the badge renders.
add_filter( 'benecaster_explicit_badge_label', function ( string $label, string $mode ): string {
return 'clean' === $mode ? $label : 'E';
}, 10, 2 );
// 2. Restyle without touching templates — the class list already carries
// two modifiers (--{mode} + --context-{surface}), so plain CSS handles
// most cases. The HTML filter is the escape hatch when class-only styling
// is not enough (e.g. injecting an <svg> icon for aria-hidden purposes).
add_filter( 'benecaster_explicit_badge_html', function ( string $html, int $episode_id, int $show_id, string $mode, string $context ): string {
if ( 'clean' === $mode ) {
return $html; // leave the empty string alone
}
return sprintf(
'<span class="my-explicit" role="img" aria-label="%s"><svg aria-hidden="true"></svg><span class="visually-hidden">%s</span></span>',
esc_attr__( 'Explicit content', 'my-theme' ),
esc_html__( 'Explicit', 'my-theme' )
);
}, 10, 5 );
// 3. Force the badge on a specific episode without touching the stored
// meta — useful for a one-off override during a special series.
add_filter( 'benecaster_explicit_badge_mode', function ( string $mode, int $episode_id, int $show_id ): string {
return 12345 === $episode_id ? 'yes' : $mode;
}, 10, 3 );