• Resolved Micah Miller-Eshleman

    (@micahjm)


    Hi,

    I’d like to use the episode title as the <itunes:subtitle>, instead of the episode excerpt. If there was a filter to modify episodes before constructing the feed, I could write the code myself but I haven’t found such a filter in the docs. I suppose I could use a WordPress excerpt filter to set the excerpt equal to the post title, but this feels like a hack. I’m open to your suggestions.

    Also, thanks for a well-documented, frequently updated plugin.

    – Micah

    https://ww.wp.xz.cn/plugins/seriously-simple-podcasting/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Hugh Lashbrooke

    (@hlashbrooke)

    There’s no filter in SSP for that, but you could theoretically filter the excerpt using the get_the_excerpt filter. The problem there is that the only parameter available to that filter is the excerpt itself and not the post ID or any other identifying data.

    I’ll see if I can improve the feed template here, but that will only be in the next release.

    Cheers,
    Hugh

    Thread Starter Micah Miller-Eshleman

    (@micahjm)

    Thanks Hugh, here’s a quick workaround.

    /**
     * Set the podcast title as the excerpt, so it gets used for the itunes:subtitle field
     */
    function gc_podcasts_use_title_as_excerpt() {
    	global $post;
    	if (is_feed() and $post->post_type == 'podcast') {
    		return $post->post_title;
    	}
    }
    add_filter( 'get_the_excerpt', 'gc_podcasts_use_title_as_excerpt' );

    I’m good to go, so there’s no need to update your plugin.

    Plugin Contributor Hugh Lashbrooke

    (@hlashbrooke)

    Great stuff – that snippet looks good, but there’s only one change that I would recommend as a better way to check if you are viewing the podcast feed specifically. You’ll also need to return the default value even if the conditional fails, so here’s the updated code:

    /**
     * Set the podcast title as the excerpt, so it gets used for the itunes:subtitle field
     */
    function gc_podcasts_use_title_as_excerpt( $excerpt ) {
      if ( is_feed( 'podcast' ) ) {
        global $post;
        $excerpt = $post->post_title;
      }
      return $excerpt;
    }
    add_filter( 'get_the_excerpt', 'gc_podcasts_use_title_as_excerpt' );

    Cheers,
    Hugh

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Use post_title as itunes:subtitle’ is closed to new replies.