Post Pic

Hack: insert ads in your RSS feed

Some time ago, I featured a recipe about inserting ads on your rss feed. Sadly, some users had problems and reported that the function don’t work (althought some users said it worked, strange). So here’s a new recipe to insert text or ads in your rss feed.

If you have problem while using the recipe here, try that one:
Simply paste the following code on the functions.php file from your theme. Create that file if it doesn't exists by default.

function insertRss($content) {
    if(is_feed()){
        $content = 'text before content'.$content.'<hr /><a href="http://www.wprecipes.com">Did you visited WpRecipes today?</a><hr />';
    }
    return $content;
}
add_filter('the_content', 'insertRss');

Another great way to insert ads or anything in to your rss feed is the Rss Footer plugin by Joost de Valk.

Thanks to Julien Chauvin for the great tip!

14 Responses

Dec 22 2008 13:51

Does this work in feedburner?

Dec 22 2008 13:55

@levin: Didn’t tried, but it should work. You’ll probably have to resync your feed, though.

Dec 31 2008 07:37

Yeah, It’s working for me in FeedBurner without any problems. ;)

Jul 17 2009 04:06

JBJ, Do you have any idea to insert ads in the midle of post, like yours?

Dec 29 2009 23:37

@rismaka: Actually, the ads on the middle of the post here may be a theme or design thing. The feed is a completely different thing.

Trackbacks:

Leave a Comment

* Name, Email, Comment are Required