Skip to main content

benecaster_episode_card_excerpt

Filter Free

Filters the episode excerpt string rendered in each archive card.

Return a string. Cast with (string) and output through esc_html(), so markup becomes literal text.

Returning an empty string SHORT-CIRCUITS the excerpt element entirely — the template returns, so no empty <p> is emitted. That is the supported way to hide an excerpt per episode.

Parameters

Name Type Default Description
$excerpt string — Episode excerpt text
$episode_id int — ID of the episode
$show_id int — ID of the show

Returns: string

Example

add_filter( 'benecaster_episode_card_excerpt', function( $excerpt, $episode_id, $show_id ) {
    // Trim the excerpt to 120 characters and append an ellipsis.
    if ( mb_strlen( $excerpt ) > 120 ) {
        return mb_substr( $excerpt, 0, 120 ) . '…';
    }
    return $excerpt;
}, 10, 3 );

Affects

  • archive/episode-card/excerpt.php template part

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