Skip to main content

benecaster_listener_support_output

Filter Free

Filters the finished HTML of a Listener Support prompt — the link-mode prompt and the Stripe donation widget alike — just before it is returned. Use it to wrap the output in a container, replace it, add a data attribute or inject extra markup.

It fires even when the output is empty, because Listener Support is switched off or not set up, so returning HTML there renders a fallback call to action. An administrator whose Stripe keys are missing sees a setup notice instead, and that notice deliberately does not pass through this filter.

Parameters

Name Type Default Description
$html string — The rendered HTML, which may be empty
$style string — Which variant rendered: `'inline'`, `'floating'` or `'after-player'` for a link-mode prompt; `'form'`, `'button'` or `'icon'` for the Stripe donation widget
$show_id int — The show the prompt is for, or `0` when there is no show context

Returns: string

Example

add_filter( 'benecaster_listener_support_output', function ( string $html, string $style, int $show_id ): string {
    // Wrap every prompt in a container carrying the show, for your own styling.
    if ( '' !== $html ) {
        $html = sprintf( '<div class="my-support-widget" data-show="%d">%s</div>', $show_id, $html );
    }
    return $html;
}, 10, 3 );

Notes

The third argument is the show ID on both paths. Don't type-hint it as an array.

See the benecaster_listener_support shortcode for placement and configuration options.

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