[wp-hackers] Prepend blog name in comment feed's title

Thomas Scholz info at toscho.de
Sat Oct 10 00:17:39 UTC 2009


Peter Westwood:

> There is a filter on the "Comments on" bit.
>
> If you dig into the translation functions there are filters to let  
> plugins modify the translated string which can be used to prepend  
> something here.

Thanks, that was it!

Here's my code (replace 'Kommentare zu:' with 'Comments on:' in english  
blogs):

// functions.php
add_filter('gettext', 'rss_title_prefix');

function rss_title_prefix($str)
{
	if ( is_feed() AND is_singular() )
	{
		return str_replace('Kommentare zu:', get_bloginfo('name') . ' -  
Kommentare zu:', $str);
	}
	return $str;
}

I've updated my blog post at  
<http://toscho.de/2009/wordpress-kommentarfeed-blogname/>.

Regards
Thomas

-- 
Redaktion, Druck- und Webdesign
http://toscho.de · 0160/1764727
Twitter: @toscho


More information about the wp-hackers mailing list