How to Add Banner Ad to WordPress Blog RSS Feed

If you need to add a banner to the end of each post in your RSS blog feed but don’t want to display it in your normal posts there is a simple way to do it. Simply paste this into your functions.php and edit as needed:

// Ad in RSS Feed
function ad_in_feed($content) {
  if(is_feed()) {
  $the_ad = '[banner code here]';
  return $content.$the_ad;
}
else { return $content; }
}

add_filter('the_content', 'ad_in_feed');
Tags:

Leave a Reply