wp-subtitle icon indicating copy to clipboard operation
wp-subtitle copied to clipboard

Include Subtitle in RSS Feed

Open lacymorrow opened this issue 10 years ago • 3 comments

Currently the subtitle does not get pulled into the RSS feed. I would like it to be displayed afterward. It looks like currently the only way to accomplish this is to override the feed generation functions but it would be great to see this feature included in future versions.

lacymorrow avatar Jan 28 '15 23:01 lacymorrow

Where a bouts would you want it included? As part of the RSS title? Or at the top of the content?

benhuson avatar Jan 30 '15 20:01 benhuson

That's a good question and my opinion shouldn't be seen as the answer. Subtitles may have different importance for different sites. In my case, they were direct afterthoughts to the real title. Ex... (not real titles) Title: New genetic breakthroughs Subtitle: Following a genetic counselor

In my case I appended to the title in the RSS feed, separated by a hyphen. E.g. New genetic breakthroughs - Following a genetic counselor

lacymorrow avatar Feb 06 '15 22:02 lacymorrow

Here is the code i used in functions.php:

/**
 * Custom RSS feed to attach subtitles to feed title
 */
// add custom feed content
function add_feed_subtitle($title) {
    if(is_feed()) {
        $subtitle = get_post_meta(get_the_ID(), 'wps_subtitle', true);
        if ($subtitle != ''){
            return $title . ' - ' . $subtitle;
        }
    }
    return $title;
}
add_filter('the_title', 'add_feed_subtitle');

lacymorrow avatar Feb 06 '15 22:02 lacymorrow