Skip to main content

Inject a “Listen now” CTA button into every archive episode card

Free Beginner Since v1.0.0

Use benecaster_after_episode_card_title to append markup after the episode title inside each card — without overriding the whole archive/episode-card/title.php template. Useful for adding a listen button, a tier badge, or an episode type label that does not belong in the title itself. The action fires with ( int $episode_id, int $show_id ).

Code

<?php
add_action(
    'benecaster_after_episode_card_title',
    function ( int $episode_id, int $show_id ): void {
        $permalink = get_permalink( $episode_id );
        ?>
        <a href="<?php echo esc_url( $permalink ); ?>"
           class="benecaster-card-cta benecaster-btn benecaster-btn--sm">
            <?php esc_html_e( 'Listen now', 'my-theme' ); ?>
        </a>
        <?php
    },
    10,
    2
);

View on GitHub →

Hooks Used