How to Insert Ads In Your Wordpress RSS Feeds
Sunday, April 5, 2009 - Labels: Blogging - 0 Comments
Many Bloggers want to add ads in RSS feeds, the first option is FeedBurner which can insert AdSense ads into your feed items, but for that you need at least 500 subscribers to qualify, and you can’t use any ads other than the AdSense ads provided by FeedBurner.
It is possbile to insert other kinds of ads into your RSS feed with some easy tweaks
Follow these simple steps to perform this hack:
* Edit the functions.php file of your theme. If your theme doesn’t have a functions.php file, simply create one.
* Paste the following code into your functions.php file:
<?php
function insertAds($content) {
$content = $content.'<hr /><a href="http://www.wprecipes.com">Have you ?</a><hr />';
return $content;
}
add_filter('the_excerpt_rss', 'insertAds');
add_filter('the_content_rss', 'insertAds');
?>
* Save the file. You’re now displaying your ads in your RSS feed!
Explanation: First a function called insertAds() is created, which concatenate a code containing our advertisment to the $content variable, which contains the content of the post. Then, the add_filter() function is used to overwrite the the_content_rss() function with insertAds() function. Another filter is used to overwrite the_excerpt_rss() function as well.Now, rss feeds now displays your ads!
Source
This entry was posted on 10:35 PM
and is filed under
Blogging
.
You can follow any responses to this entry through
the RSS 2.0 feed.
You can leave a response,
or trackback from your own site.
0 comments:
Post a Comment