Skip to main content

Replace or wrap the assembled Supporter Wall HTML

Free Intermediate Since v1.0.0

Fires after the default markup is assembled for both the populated and empty branches of [benecaster_supporter_wall]. $html is the complete rendered output. $subscribers is the raw row array from SupporterWallQuery::find() — each row has user_id, display_name, user_login, first_name, tier_slug, joined_at. On the empty branch, $subscribers is an empty array. For copy-only customization, benecaster_supporter_wall_empty_message is narrower.

Code

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

View on GitHub →

Hooks Used