Skip to main content

Teaser show notes on the public feed, full notes for supporters

Free Beginner

$tier_slug makes the per-tier feed a structured edit instead of string surgery on the finished XML. The public feed compiles as tier public.

Set all three keys. Apps differ in which one they show, and they hold different values by default — changing description alone leaves the full notes in <content:encoded>, which is what Apple Podcasts displays.

This changes the public feed only. The episode page on the website is gated separately (benecaster_user_can_access_episode(), [benecaster_tier_gate]).

Code

<?php
add_filter( 'benecaster_feed_episode_data', function ( array $data, int $episode_id, int $show_id, string $tier_slug ): array {
    if ( 'public' !== $tier_slug ) {
        return $data; // Paying tiers keep the full notes.
    }
    $teaser = wp_trim_words( $data['description'], 40 ) . ' Full notes for supporters.';
    $data['description']     = $teaser;                                  // <description>
    $data['summary']         = $teaser;                                  // <itunes:summary>
    $data['content_encoded'] = '<p>' . esc_html( $teaser ) . '</p>';     // <content:encoded>
    return $data;
}, 10, 4 );

View on GitHub →

Hooks Used

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