Skip to main content

Inject Podlove Simple Chapters inline into the feed

Free Beginner Since v1.0.0

Use the benecaster_psc_chapters filter to supply a structured chapters array for each episode. The compiler injects psc:chapters and psc:chapter elements inline into the feed item.

Code

<?php
add_filter( 'benecaster_psc_chapters', function ( array $chapters, int $episode_id ) {
    $raw = get_post_meta( $episode_id, '_my_psc_chapters', true );
    if ( ! $raw ) {
        return $chapters;
    }
    // Stored as JSON: [{"start":"00:00:00.000","title":"Intro","href":"https://..."}]
    $decoded = json_decode( $raw, true );
    return is_array( $decoded ) ? $decoded : $chapters;
}, 10, 2 );

View on GitHub →

Hooks Used