Skip to main content

benecaster_donor_wall_item

Filter Free

Fires once per rendered row of the donor wall, wrapping the built-in card markup. Receives the complete HTML string for a single donor card, the raw donation row object, and the show ID.

Return the $html unchanged to pass through, return a replacement string to swap the card wholesale, or return '' to suppress the row entirely. Suppressing a row leaves the outer .benecaster-donor-wall wrapper in place — downstream CSS that targets the wrapper class keeps working even when all rows are suppressed.

Additive decoration is safer than wholesale replacement. Using str_replace to inject markup into specific BEM elements keeps the card functional if the default markup evolves — wholesale replacement means your override must track every upstream card change manually.

Composable with other _item callbacks. Multiple callbacks on this filter run in WordPress priority order. The donor-wall-highlight-top-supporters (badge) and donor-wall-per-tier-message (tier label) recipes both use this filter and compose cleanly — each receives the HTML as the previous callback left it.

Parameters

Name Type Default Description
$html string — The fully-rendered HTML for a single donor card, as built by the shortcode.
$donation object — The raw donation row. Relevant properties: `amount` (float|null), `currency` (string|null), `display_name` (string|null), `donated_at` (string — ISO 8601), `note` (string|null), `platform` (string).
$show_id int — WordPress post ID of the show whose wall is being rendered.

Returns: string

Examples

Prepend a badge to cards at or above a threshold

add_filter( 'benecaster_donor_wall_item', function ( string $html, object $donation, int $show_id ): string {
    $amount = isset( $donation->amount ) ? (float) $donation->amount : 0.0;
    if ( $amount < 100.00 ) {
        return $html;
    }
    $badge = '<span class="my-top-badge">★</span>';
    return str_replace( '<div class="benecaster-donor-wall__header">', '<div class="benecaster-donor-wall__header">' . $badge, $html );
}, 10, 3 );

Suppress a row entirely

add_filter( 'benecaster_donor_wall_item', function ( string $html, object $donation, int $show_id ): string {
    // Hide all anonymous entries.
    if ( empty( $donation->display_name ) ) {
        return '';
    }
    return $html;
}, 10, 3 );

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