Play subscribers their tier’s audio in your own theme template
Benecaster’s episode page, archive card and download link play a subscriber the audio variant their tier gets in the feed (an ad-free cut for Gold subscribers, say), set on the Episode Editor’s Media tab. A theme that overrides those templates, or builds its own player, gets the same file by asking benecaster_get_episode_audio_url() instead of reading the episode’s audio URL directly.
The URL has already been through benecaster_episode_audio_url, so CDN-signing callbacks and the preview clip still apply. Do not run the filter on it again.
Code
<?php
// {theme}/benecaster/episode/player.php, or any template with an episode ID.
if ( benecaster_user_can_access_episode( $episode_id, $show_id ) ) {
$src = benecaster_get_episode_audio_url( $episode_id );
if ( '' !== $src ) {
printf( '<audio controls preload="metadata" src="%s"></audio>', esc_url( $src ) );
}
}
Hooks Used
Need this built rather than just documented? See our services →