Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include Subtitle in RSS Feed #6

Open
lacymorrow opened this issue Jan 28, 2015 · 3 comments
Open

Include Subtitle in RSS Feed #6

lacymorrow opened this issue Jan 28, 2015 · 3 comments

Comments

@lacymorrow
Copy link

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.

@benhuson
Copy link
Owner

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

@lacymorrow
Copy link
Author

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
Copy link
Author

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');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants