Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to customize a WordPress feed. I know that if I modify wp-includes/feed-rss2.php, the feed is modified. But I don't want to modify this file, as it might get overwritten during an upgrade. I tried copying the file to wp-content/themes/mytheme/feed-rss2.php, but the file seems to be ignored. I found this article on customizing WordPress feeds, but the article is very old and references files that are just dummy files now.

Background: Here's what I'm actually trying to do, in case there is a better way to do it. Our company has a WordPress blog. The copy of the posts could have been written by anybody, but only one of the two marketing guys actually posts on the blog. I want to overwrite the author attribute in the feed so that they author always displays as "Acme, Inc." instead of showing the marketing guy's name. I've customized the blog pages to do this, but the feed still shows the user name. I tried changing both marketing guys' usernames to "Acme, Inc.", but they didn't like that because they couldn't tell them apart when they needed to edit posts.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Feed templates are special case. You can't simply provide your own template - you need to work with do_feed_ hooks to change handler function.

But for your specific question it is much easier to override author. Try this (not tested):

add_filter( 'the_author', 'feed_author' );

function feed_author($name) {

    if( is_feed() )
        return 'Acme, Inc.';

    return $name;
}
share|improve this answer
    
worked perfectly as written. thanks! –  Kip Feb 10 '11 at 21:02
    
FYI- this code goes in wp-content/themes/mytheme/functions.php. (I was trying to remember where I changed this and it wasn't on the page anywhere.) –  Kip Oct 7 '11 at 20:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.