WordPress

Add Content After RSS Feed In WordPress

Using WordPress hooks you can overwrite or add extra functionality to the existing WordPress core functions.

WordPress uses two functions for it's RSS the_excerpt_rss which will display a bit of the content on a post and the_content_rss. So using hooks on these functions we can add extra functionality to these, which is a good place to put a closing message or maybe some advertisement.

Blog Advertisement

Many blogs display advertisements on the sidebar or on the top or bottom of single posts. This is good for visitors who come to your website, they will be able to see your advertisements. But what about the readers that have subscribed to your RSS feed and will not visit the site to view your posts they won't see your advertisements. These advertisements could be your brand new ebook or product and most of your loyal readers might miss out on this because they are using your RSS feeds.

The solution to this problem is to add content to your RSS feed single posts so you can display these messages to these readers.

Add Hook To WordPress RSS Feed

Add the following code to your functions.php page and you will be able to add additional content to the end of the excerpt RSS feed and the actual content RSS feed.

function addToRSS() {

    return '<hr /><p>Remember to stop by at <a href="http://www.paulund.co.uk/">Paulund</a></p>';

}

add_filter('the_excerpt_rss', 'addToRSS');
add_filter('the_content_rss', 'addToRSS');
Back to top