Skip to main content

benecaster_episode_count_output

Filter Free

Filters the rendered output of benecaster_episode_count before it is returned to the page.

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
$output string Rendered HTML
$count int Episode count
$show_id int ID of the show
$atts array Resolved shortcode attributes

Returns: string

Example

add_filter( 'benecaster_episode_count_output', function( $output, $count, $atts ) {
    // Format the count with a singular/plural suffix.
    $label = 1 === $count ? 'episode' : 'episodes';
    return '<strong>' . number_format_i18n( $count ) . '</strong> ' . $label;
}, 10, 3 );