Drop a user’s badge chips into a custom theme template
benecaster_render_user_badges( int $user_id = 0, ?int $show_id = null ): string looks up the user’s badges via benecaster_get_user_badges() (so the benecaster_user_badges filter applies) and returns the chip HTML. Output is already escaped. For surfaces that already hold badge rows in memory, inject BadgeChipRenderer and call render_chips( array $badges ): string directly. BadgeChipRenderer::serialize_for_rest() returns the same shape used by the subscribers REST endpoints.
Code
<?php
// Theme template (e.g. author.php) — display the post author's badges below their name.
$badges_html = benecaster_render_user_badges( (int) get_the_author_meta( 'ID' ) );
if ( '' !== $badges_html ) {
// Output is already escaped by BadgeChipRenderer.
echo $badges_html;
}