I would like that the RSS entries titles be like this:
“this is the post title [category1, category4]”
In square brackets are listed the categories in which the post is filed.
I first modified the wp-feed.php file, but it’s dirty: every wordpress update will erase my changes. So i think i can do this via add_filter. I set it up like this, but i don’t know how i can have access to the post categories within my function. Any idea?
function rssTitle_add_categories($title) {
// how do i retrieve the category array ?
$categories = join(', ', $category_array);
$title = $title . '['.$categories.']';
return $title;
}
add_filter('the_title_rss', 'rssTitle_add_categories');
When
the_title_rss
filter functions are called (from the feed templates) you are inside a WordPress posts loop, and so the usual functions should work. You should be able to do something like this: