Support Forum

Post Author included in Title for RSS feeds

DI Duke Leto III
Duke Leto III
Member

I’m curious if this is intended design, or if i missed an option or this is an oversight…

Typically in RSS feeds the Author is a separate parameter from the thread title… 

This has been extremely annoying while trying to use RSS with a RSS widget for displaying  a “recent posts” widget in the sidebar. 

 

Is there a way to change the code or something to remove the author from appearing in the title tags? 

 

I’ve been banging my head against the wall trying to figure out why disabling “Display Author” in the widget options wielded no results lol

 

Thanks!

13 Answers

New Answer

MP Mr Papa
Mr Papa
Member

the widget is not rss feeds… so of course doing anything in the widget will NOT affect RSS feeds…

but we have filters in place to allow you to do what you want..  think there are several posts on the topic… but can pass along again if you want…

and in the next version, 5.2, that will be an option for the rss feeds directly…

DI Duke Leto III
Duke Leto III
Member

What i meant to say was that the widget has the option to display or not certain parameters of the RSS feed input. I tested with other RSS feeds and they appear to separate the author from the Title. In the RSS feeds generated by simple press, the author appears IN the title tags, as <title>[author] on [thread title]</title>

I did try searching these forums for related topics but came up empty handed. I’ll search some more now, but in the mean time if you could pass along the topics you mention, that’d be handy. 

Thanks!

MP Mr Papa
Mr Papa
Member

oh you meant an rss widget, not our recent posts widget… got it… and yes, by default our title includes who posted it…

but what I said still applies, until we the option is available in the next version, you will need to use a filter to remove it… something like this…

add_filter('sph_feed_item', 'my_feed_title_filter',10,2);
function my_feed_title_filter($item, $spThisPostList) {
    $item->title = $spThisPostList->topic_name;
    return $item;
}

put that in your sp theme spFunctions.php… and be sure to have created your own theme (http://codex.simple-press.com/codex/themes/theme-basics/creating-a-theme/) vs editing ours directly or changes will be lost on upgrades…

>

DI Duke Leto III
Duke Leto III
Member

That bit of code worked perfectly. Thanks very much, Mr Papa! 

The quick support was most definitely appreciated. 

MP Mr Papa
Mr Papa
Member

No problem. Glad to help. And it will be an option in the next version, but your custom filter will continue to work too… >

RK Rem Kingston
Rem Kingston
Member

Apologies for digging up an old thread but search brought me here!

 

Does the option to tweak RSS title output per a forum/group now exist.  If so, where abouts would I find it Mr Papa?

 

Many thanks in advance! 🙂

YS Yellow Swordfish
Yellow Swordfish
Member

i have to say I don’t remember this from almost 3 years ago! but having looked I can’t actually find anything on it. The filter above should still work thigh.

Mr Papa will be along later so if I have missed something I am sure he will let us both know…

RK Rem Kingston
Rem Kingston
Member

Does this work per a forum or would that remove all authors from all RSS feeds?

MP Mr Papa
Mr Papa
Member

that would be on all forums…  if you want to be more specific, you will need to check the forum in question… something like:

add_filter('sph_feed_item', 'my_feed_title_filter',10,2);
function my_feed_title_filter($item, $spThisPostList) {
    if ($spThisPostList->forum_id == 2) $item->title = $spThisPostList->topic_name;
    return $item;
}

which will only do the replacement on forum id of 2…   would go in your spFunctions.php file of your sp theme..  as always we recommend a child theme or create your own theme…

RK Rem Kingston
Rem Kingston
Member

Forgive my newbness Mr Papa but how would I edit your code to include more than one forum in your change.

 

For example:

Forum ID 12 & 15 to have their RSS feed effected only?

MP Mr Papa
Mr Papa
Member

like this:

add_filter('sph_feed_item', 'my_feed_title_filter',10,2);
function my_feed_title_filter($item, $spThisPostList) {
    if ($spThisPostList->forum_id == 12 || $spThisPostList->forum_id == 15) $item->title = $spThisPostList->topic_name;
    return $item;
}