benecaster_platform_links_output
Filters the final rendered HTML of the benecaster_platform_links shortcode and the Platform Links Episode Page block. The $links array reflects only platforms with a non-empty URL configured in Show Settings — platforms that have no URL set are already excluded before this filter fires.
Use to wrap the badge group in a custom container element, inject additional hand-coded badges after the rendered output, or replace the HTML entirely. Return an empty string to suppress the block.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$html |
string |
— | Rendered badge links HTML |
$links |
array |
— | Normalized {platform, url, label} objects passed to the renderer, already filtered by the platforms attribute. Can include an rss entry the podcaster never typed (the show's own public feed) unless they set one themselves or rss="false" is used |
$atts |
array |
— | Resolved shortcode attributes including show_id, style, and platforms |
Returns:
string
Examples
Suppress when empty, wrap with accessible container
add_filter( 'benecaster_platform_links_output', function ( $html, $links, $atts ) {
if ( empty( $links ) ) {
return '';
}
return '<div class="platform-badges" aria-label="Listen on your favorite app">' . $html . '</div>';
}, 10, 3 );
Wrap badges in nav element
add_filter( 'benecaster_platform_links_output', function ( string $html, array $links, array $atts ): string {
return '<nav aria-label="Listen on">' . $html . '</nav>';
}, 10, 3 );
Append custom badge after rendered output
add_filter( 'benecaster_platform_links_output', function ( string $html, array $links, array $atts ): string {
$extra = '<a href="https://example.com/feed" class="platform-badge">Custom App</a>';
return $html . $extra;
}, 10, 3 );
Notes
Platform display order follows the order entries appear in Show Settings. The platforms shortcode attribute acts as a filter only — it does not reorder. To reorder programmatically, use a filter that fires earlier in the rendering chain rather than rearranging the HTML here.
Affects
- benecaster_platform_links shortcode
- Platform Links Episode Page block
Need this built rather than just documented? See our services →