Put a “Powered by Benecaster” referral link in your theme’s footer
Anyone who signs up through your referral link earns you credit, but only if they see it. The benecaster_referral_link shortcode prints your link and drops into any page or widget. To put it on every page at once, render it from your theme’s footer.
It prints nothing when there is no link to show: no license, no link from the license server yet, or a license that is no longer active. So check for empty output before adding markup around it, or you will print an empty wrapper on those sites.
It never includes your credit balance. Nothing here can add one, and you should not add one through the filter: a cached balance can be out of date.
When to Use This
Use this when you want a “Powered by Benecaster” credit on every page of your site, or when the default link needs to match your theme’s styling.
How It Works
Hook wp_footer in a child theme or an add-on, call do_shortcode() with the shortcode you want, and print the result inside your own markup only when it is not empty. To change how the link looks everywhere it appears, wherever you place it, filter benecaster_referral_link_output.
Notes
The output is already escaped. The shortcode escapes its own link and label, so print the returned HTML as it is and escape anything you add around it.
style="url" returns the bare address, not an anchor. The filter’s $atts['style'] tells you which form you were handed, so a restyling callback can leave the URL alone.
Code
<?php
// In a child theme's functions.php:
add_action( 'wp_footer', static function (): void {
$link = do_shortcode( '[benecaster_referral_link label="Podcast memberships powered by Benecaster"]' );
if ( '' === $link ) {
return; // No cached referral link, or the licence is not active.
}
printf( '<p class="site-credit">%s</p>', $link ); // Already escaped by the shortcode.
} );
// Or restyle it everywhere it appears:
add_filter( 'benecaster_referral_link_output', static function ( string $html, string $link, array $atts ): string {
return 'url' === $atts['style'] ? $html : '<span class="my-credit">' . $html . '</span>';
}, 10, 3 );
Hooks Used
Need this built rather than just documented? See our services →