Skip to main content

benecaster_social_links_output

Filter Free Since v1.0.0

Filters the final rendered HTML of the `[benecaster_social_links]` shortcode and the Social Links Episode Page block. This filter fires after the link data has already been filtered by [benecaster_show_social_links](/hooks/benecaster_show_social_links/) and passed to the renderer.

Use this filter to change the icon or button markup, wrap the output in a custom container, or replace the HTML entirely. To add, remove, or reorder the underlying link data before rendering, use [benecaster_show_social_links](/hooks/benecaster_show_social_links/) instead.

Parameters

Name Type Default Description
$html string Rendered HTML output
$links array Filtered `{platform, url, label}` link objects passed to the renderer
$atts array Resolved shortcode or block attributes

Returns: string

Examples

Wrap in ARIA-labelled container

add_filter( 'benecaster_social_links_output', function( $html, $links, $atts ) {
    if ( empty( $links ) ) {
        return '';
    }
    return '<div class="social-links-block" aria-label="Follow the show">' . $html . '</div>';
}, 10, 3 );

Wrap in semantic nav element

add_filter( 'benecaster_social_links_output', function( string $html, array $links, array $atts ): string {
    return '<nav class="social-links" aria-label="Social profiles">' . $html . '</nav>';
}, 10, 3 );

Affects

  • [benecaster_social_links] shortcode
  • Social Links Episode Page block