Skip to main content

benecaster_supporter_wall_output

Filter Free Since v1.0.0

Filters the complete HTML output of the `[benecaster_supporter_wall]` shortcode — covering both the populated branch (subscriber cards are rendered) and the empty branch (no opted-in subscribers found). The filter fires immediately before the shortcode returns, after all card markup is assembled.

Check `empty( $subscribers )` inside your callback to distinguish the empty state from the populated state. Each entry in `$subscribers` is an object with: `user_id`, `display_name`, `user_login`, `first_name`, `tier_slug`, and `joined_at`. For empty-state copy changes only, the narrower [benecaster_supporter_wall_empty_message](/hooks/benecaster_supporter_wall_empty_message/) filter is simpler and avoids having to reconstruct surrounding markup.

Parameters

Name Type Default Description
$html string Full rendered wall HTML
$show_id int ID of the show
$subscribers array Array of subscriber objects rendered in the wall
$atts array Resolved shortcode attributes

Returns: string

Examples

Wrap wall with supporter count heading

add_filter( 'benecaster_supporter_wall_output', function (
    string $html,
    int $show_id,
    array $subscribers,
    array $atts
): string {
    if ( empty( $subscribers ) ) {
        return $html;
    }
    $count   = count( $subscribers );
    $heading = sprintf(
        '<h2 class="wall-heading">%s</h2>',
        sprintf( _n( '%d Supporter', '%d Supporters', $count, 'my-theme' ), $count )
    );
    return '<section class="my-supporter-wall-section">' . $heading . $html . '</section>';
}, 10, 4 );

Suppress wall entirely when empty

add_filter( 'benecaster_supporter_wall_output', function (
    string $html,
    int $show_id,
    array $subscribers,
    array $atts
): string {
    return empty( $subscribers ) ? '' : $html;
}, 10, 4 );

Affects

  • [benecaster_supporter_wall] shortcode