Skip to main content

[benecaster_player]

Free

Embeds an episode audio or video player. Respects access controls — if the current user does not have access to the episode, renders the output of benecaster_locked_content_message instead of the player. Renders in all contexts including pages, posts, and widget areas.

Who can play it

The player asks benecaster_user_can_access_episode(), the same question the feed and download links ask, so a logged-in listener who holds the episode through their tier, a buy-up or a standalone grant can play it here. Everyone else gets the locked message, or the preview clip when the episode has one. A benecaster_episode_is_accessible callback that returns false locks the player too, including for a public episode.

Preview clips. With a Preview clip URL set on the episode, a visitor who can’t access it gets a player playing the clip instead of the locked message. The locked message still shows when the episode has no clip.

What plays. An episode with an audio URL plays its audio; a video-only episode plays its video, with the episode artwork as the poster frame. When the episode has both, media chooses, and either value falls back to the file that exists. The audio URL runs through benecaster_episode_audio_url with $tier_slug set to null, the same website call the episode page and archive card make, and the video URL through benecaster_episode_video_url with ( $url, $episode_id, $show_id ). Any callback registered on either filter changes what plays here too.

Video only for a visitor who can access the episode. A benecaster_show_episode_player callback that opens the player for a locked visitor (the preview clip does this) gets the audio player, because the clip is swapped in on the audio URL and nothing swaps a video. On a video-only episode that visitor gets the locked message.

The video is a plain native element. The Video Podcast Enhanced add-on replaces it with its own player through benecaster_player_output.

Styling

The player wrapper uses BEM classes. The block is .benecaster-player; the style modifier is .benecaster-player--standard, .benecaster-player--minimal, or .benecaster-player--card (set from the style attribute). The wrapper also carries data-episode-id and data-show-id attributes used by the frontend JS beacon.

Three element classes render inside the wrapper: .benecaster-player__artwork (wraps img when show_artwork is truthy and the episode has artwork), .benecaster-player__title (a p rendered when show_title is truthy and the title is non-empty), and .benecaster-player__audio (native audio controls preload="none"). The locked-state message uses .benecaster-locked on a p.

When video plays, the wrapper gains .benecaster-player--video and holds .benecaster-player__video (native video controls playsinline preload="none", the artwork as its poster when show_artwork is truthy) in place of the audio element; there is no separate artwork image. Keep the wrapper and its data- attributes if you replace the markup, so the play beacon still counts the play. The replace-the-player-video-element recipe shows the pattern.

The player is covered by Benecaster’s base stylesheet for its shortcodes. Every rule has zero specificity, so your theme’s CSS for these classes always wins; the benecaster_shortcode_base_styles filter turns it off. No inline style="" attributes are printed. No template override path exists — the render is fully inline; there is no templates/player/ directory and no benecaster_locate_template() call.

For markup-level customization use the two PHP filters: benecaster_player_output ($html, $episode_id, $atts) mutates the final HTML string; benecaster_locked_content_message ($html, $episode_id, '', $user_tier, $show_id) mutates the locked-state message HTML.

Parameters

Name Type Default Required Description
episode_id int current episode No ID of the episode to play. Defaults to the current episode when rendered inside a single episode template. Only a published episode renders for visitors; a draft, scheduled or private one renders nothing, except for someone who can edit that episode, who still sees the player so they can preview the page before release.
show_id int — No If episode_id is not set, plays the latest episode of this show. On single-show installs, may be omitted — the sole show is used. On a multi-show site with no episode_id, no show_id and no current episode, it renders nothing.
style string standard No Player layout. Options: standard, minimal, card.
show_title bool true No Whether to display the episode title above the player.
show_artwork bool true No Whether to display episode artwork alongside the player. On a video, the artwork is the poster frame instead of a separate image.
media string audio No Which file plays when the episode has both an audio and a video URL. Options: audio, video. Either falls back to the other when the episode has only one, so a video-only episode always plays video. A visitor who cannot access the episode never gets video.

Example

<!-- Play a specific episode with the card style -->
[benecaster_player episode_id="42" style="card"]

<!-- Play latest episode of a show, minimal style, no artwork -->
[benecaster_player show_id="5" style="minimal" show_artwork="false"]

<!-- Play the video of an episode that has both files -->
[benecaster_player episode_id="42" media="video"]