Inserting ads in RSS feeds.
Advertisements
Inserting Ads in your blog’ RSS feed can be a good idea to boost up your earnings. You may have seen many peoples doing this.
If you publish your feeds with FeedBurner (now acquired by Google) then you can easily show Adsense ads there at by using Adsens for feeds.
And if you want to show other ads in your RSS feeds, then you can do this by modifying the functions.php file (if you dont have one create it).
<?php
function insertAds($content) {
$content = $content.’<hr /><a href=”http://webmasters-blog.com/”>Keep visiting webmasters-blog.com</a><hr />’;
return $content;
}
add_filter(‘the_excerpt_rss’, ‘insertAds’);
add_filter(‘the_content_rss’, ‘insertAds’);
?>
Here, we first create a function called insertAds(), which concatenate a code containing our advertisment to the $content variable, which contains the content of the post.
Then, we use the add_filter() function to overwrite the the_content_rss() function with our insertAds() function. We use another filter to overwrite the_excerpt_rss() function as well.
That’s all, your rss feeds now displays your ads!
Related posts
1 Comment
Trackbacks/Pingbacks
- Total number of sites as on May 2009. « Webmaster Tips - [...] Inserting ads in RSS feeds. (0) [...]

Thanks for PHP code. I heard that Google bought Feedburner but your code tips are spot on. Kudos on the helpful blog post.