Skip to main content

benecaster_episode_card_meta

Filter Free

Filters the meta array for each episode card. Keys: episode_number, season_number, duration, pub_date. Remove keys to suppress specific meta items; add keys to inject custom meta.

Return the array. Cast with (array). Four keys are recognized: episode_number (int), season_number (int|null), duration (string) and pub_date (string, already formatted with the site’s date format).

pub_date arrives pre-formatted, not as a timestamp — it comes from get_the_date() with the site’s date_format already applied. Re-formatting it means parsing a localized string. A key the template does not recognize is ignored silently, so a misspelling reads as “the filter did nothing”.

duration arrives as the stored HH:MM:SS (00:47:23). The card shows whatever you return through benecaster_format_duration(): a duration as hours and minutes, rounded to the nearest minute (0:47, 1:02; 0:47 is forty-seven minutes), and a value that is not a duration exactly as returned, so free text replaces the figure outright. To change the format on every card and everywhere else the website shows a duration, use benecaster_duration_display instead; this filter is for one card’s values. If the duration comes out empty, the card prints no duration element.

Returning an empty array renders the card with no meta line rather than erroring.

Parameters

Name Type Default Description
$meta array — Episode card meta array; keys: episode_number, season_number, duration, pub_date
$episode_id int — ID of the episode
$show_id int — ID of the show

Returns: array

Example

add_filter( 'benecaster_episode_card_meta', function( $meta, $episode_id, $show_id ) {
    // Remove season number from meta display; show only episode number and duration.
    unset( $meta['season_number'] );
    // Inject a custom guest name field from episode meta.
    $guest = get_post_meta( $episode_id, '_show_guest_name', true );
    if ( $guest ) {
        $meta['guest'] = $guest;
    }
    return $meta;
}, 10, 3 );

Affects

  • archive/episode-card/meta.php template part

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