Change or add to the transcript the add-on shows on the site
Your theme or add-on wants a heading above the transcript, a wrapper of its own, or a note under it. Filter the markup with benecaster_transcript_display_html rather than re-rendering the transcript, so click-to-jump and the escaping stay the add-on’s.
- Keep
[data-benecaster-transcript],a.benecaster-transcript__time[data-start]and the line ids: the click handler reads them. - For someone who can edit the episode, the markup starts with a note saying who else can read the transcript. Prepending, as below, puts your heading above that note; to place something inside the transcript, search for the
section.benecaster-transcriptelement rather than assuming it comes first. - The filter never runs for a visitor who may not see the transcript, so it cannot be used to show one.
- The text in
$htmlis already escaped. Anything you add is yours to escape. - Restyle with the
benecaster-transcript__*classes instead of the filter where you can; the add-on’s stylesheet sets only layout.
Code
<?php
add_filter( 'benecaster_transcript_display_html', static function ( string $html, int $episode_id ): string {
return '<h2 class="my-transcript-heading">' . esc_html__( 'Read along', 'my-theme' ) . '</h2>' . $html;
}, 10, 2 );
Hooks Used
Need this built rather than just documented? See our services →