Skip to main content

benecaster_member_thanks_output

Filter Free Since v1.0.0

Filters the final HTML output of the [benecaster_member_thanks] shortcode before it is returned to the page. The $members parameter gives you access to the raw member records returned by the active query type — use it to rebuild the output structure entirely if the default markup does not fit your design. Each member record includes at minimum: user_id (int), display_name (string), tier_slug (string), and joined_at (string datetime).

The format shortcode attribute controls the default rendering (list, prose, or names) — but returning new HTML from this filter overrides it completely.

Parameters

Name Type Default Description
$html string Rendered HTML output of the shortcode
$members array Raw member records returned by the active query type
$atts array Resolved shortcode attributes

Returns: string

Examples

Wrap list in branded container with count heading

add_filter( 'benecaster_member_thanks_output', function( $html, $members, $atts ) {
    // Wrap the member list in a branded container with a count heading.
    $count = count( $members );
    $heading = '<h3 class="member-thanks-heading">Thanking ' . $count . ' listener' . ( $count !== 1 ? 's' : '' ) . '</h3>';
    return '<div class="member-thanks-wrapper">' . $heading . $html . '</div>';
}, 10, 3 );

Render custom card layout from raw member data

add_filter( 'benecaster_member_thanks_output', function ( string $html, array $members, array $atts ): string {
    if ( empty( $members ) ) {
        return '';
    }
    $cards = '';
    foreach ( $members as $m ) {
        $cards .= '<div class="supporter-card"><strong>' . esc_html( $m['display_name'] ) . '</strong></div>';
    }
    return '<div class="supporter-grid">' . $cards . '</div>';
}, 10, 3 );

Affects

  • [benecaster_member_thanks] shortcode