Skip to main content

benecaster_episodes_output

Filter Free

Filters the full rendered HTML output of the [benecaster_episodes] shortcode, after all episode cards are compiled and any pagination HTML is appended. Use to wrap the episode list in a container element, inject a heading above it, or append a navigation link below it.

Return the complete HTML string for the shortcode. Cast with (string).

This value becomes the shortcode’s return value and is not escaped by Benecaster — WordPress emits it as the shortcode’s output. Escape every dynamic part yourself; this is the filter to be careful with, not the display-side ones that run through esc_html().

Returning '' makes the shortcode render nothing at all, which is the supported way to suppress it conditionally. The $atts parameter is the shortcode’s resolved attributes, so a callback can scope itself to one usage rather than every instance on the site.

Parameters

Name Type Default Description
$html string Full rendered shortcode output
$show_id int ID of the show
$atts array Resolved shortcode attributes

Returns: string

Examples

Wrap episode list in accessible section

add_filter( 'benecaster_episodes_output', function( $html, $show_id, $atts ) {
    // Wrap the episode list in a labelled section for accessibility.
    return '<section aria-label="Episodes">' . $html . '</section>';
}, 10, 3 );

Append archive link after episode list

add_filter( 'benecaster_episodes_output', function ( string $html, int $show_id, array $atts ): string {
    return $html . '<a href="/episodes/" class="archive-link">View full archive →</a>';
}, 10, 3 );

Affects

  • [benecaster_episodes](/shortcodes/benecaster-episodes/) shortcode