Skip to main content

benecaster_platform_icon_svg

Filter Free

Filters the icon drawn for a platform in the icon styles of benecaster_social_links, benecaster_platform_links, benecaster_episode_share and benecaster_rss_link. Return your own SVG markup to draw your theme’s icons instead of Benecaster’s.

Every platform in the social, podcast and share lists has a built-in icon — brand marks from Simple Icons, and line icons for LinkedIn, Amazon Music, newsletter and copy_link. Any other slug, such as a custom social link a podcaster added, gets a chain-link icon.

Return the default $svg for slugs you do not replace. A custom slug a podcaster typed arrives here too.

Keep width="1em" height="1em" on your SVG. With the base stylesheet turned off nothing else sizes it, and an unsized inline SVG renders at 300×150. With it on, --benecaster-icon-size sizes it.

Do not add a <title>. The link around the icon already carries the accessible name, and the icon sits in an aria-hidden span.

Parameters

Name Type Default Description
$svg string — The default inline SVG. Printed as-is inside the shortcode's icon span.
$slug string — The platform slug — for example `spotify`, `copy_link`, `rss`, or a custom social slug.
$context string — Which shortcode is drawing it: `social_links`, `platform_links`, `episode_share` or `rss_link`.

Returns: string

Example

add_filter( 'benecaster_platform_icon_svg', function ( string $svg, string $slug, string $context ): string {
    // A filled share icon for the share buttons only; keep Benecaster's everywhere else.
    if ( 'episode_share' !== $context || 'copy_link' !== $slug ) {
        return $svg;
    }
    return '<svg width="1em" height="1em" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="10" fill="currentColor"/></svg>';
}, 10, 3 );

Affects

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