Skip to main content

benecaster_episode_page_block_types

Filter Free

Registers block type definitions for the Episode Page settings panel. Each key in the $types array is a block slug; each value is a definition array with the following keys: label (string, shown in the settings panel), default (bool, whether enabled for new shows), position ('before' or 'after' the episode player), requires (the add-on’s entitlement slug, such as benecaster-addon-guest-manager, or null), renderer (callable that returns HTML), and settings (callable that renders settings fields, or null).

requires is checked per show. On a show where that add-on is not active (not granted by the show’s license, switched off for the show, or stopped by the 30-day license-server limit), the episode page leaves the block out, and the show’s Episode Page Blocks panel shows the row faded with (requires {add-on name}). The row links to Settings → Add-ons when the show’s license has the add-on but it is switched off there, to the add-on’s shop page otherwise, or reads Coming soon for an add-on not yet released. The podcaster’s on/off choice for the block is kept, so switching the add-on back on brings the block back. A block with requires null is always available.

Registered blocks appear automatically in the settings panel and are available to the benecaster_episode_page_blocks and benecaster_episode_page_block_{slug} filters. Built-in slugs that cannot be overridden: context_bar, share_buttons, episode_nav, related_episodes, social_links, platform_links, listener_support, subscribe_cta.

guests is a placeholder for the Guest Manager add-on. Benecaster declares it (Guests in this episode, after content, requires benecaster-addon-guest-manager, off by default) so the panel can show the row before Guest Manager is installed. It renders nothing; Guest Manager’s own registration under the same key replaces it.

Parameters

Name Type Default Description
$types array — Keyed array of block type definitions

Returns: array

Examples

Register custom transcript block

add_filter( 'benecaster_episode_page_block_types', function( $types ) {
    // Register a custom Transcript block for episodes with transcript data.
    $types['transcript'] = [
        'label'    => 'Transcript',
        'default'  => false,
        'position' => 'after',
        'requires' => null,
        'renderer' => 'my_plugin_render_transcript_block',
        'settings' => null,
    ];
    return $types;
} );

Register guests block with add-on requirement

add_filter( 'benecaster_episode_page_block_types', function( array $types ): array {
    $types['guests'] = [
        'label'    => 'Guests in this episode',
        'default'  => false,
        'position' => 'after',
        'requires' => 'benecaster-addon-guest-manager',
        'renderer' => 'GuestManager\EpisodePageBlock::render',
        'settings' => 'GuestManager\EpisodePageBlock::settings_fields',
    ];
    return $types;
} );

Affects

  • Settings → Show → Episode Page panel
  • EpisodePageRenderer injection

Need this built rather than just documented? See our services →