Insert Ads or Custom Text in RSS Feeds in WordPress

Almost every WordPress blog uses RSS feeds these days to deliver content directly to readers’ mailboxes or feed readers. Also, RSS subscribers count is an important factor in deciding the blog’s popularity.

So, don’t you think that you should find out some way to monetize your RSS feeds. Maybe you can insert some affiliate link or banner ad in it. Here’s a small snippet that helps you to add any ad banner or any custom text in RSS feeds,

function insertRss($content) {
if(is_feed()){
$content = 'text before content'.$content.'<hr /><a href="http://www.agentwp.com">AgentWordPress! Best of WordPress Tips, Themes and Plugins.</a><hr />';
}
return $content;
}
add_filter('the_content', 'insertRss');

Just paste the above code snippet in the functions.php file inside your theme folder. If you don’t see any functions.php file, then simply create one. You can edit the content part (the value of $content variable) according to your requirements.


Got something to say?

Wordpress installation, upgrade, plugins and theme development are my forte. If you want to spend more time blogging and less time fiddling with your templates, plugins and technical issues, I can help. Find out more about my services, then contact me.

Wordpress Tips, Tricks & Hacks!

Make Money With Wordpress!

Try Aweber for $1 Studiopress Themes

News!