27.10.2010 in Home > Internet > WordPress by Namit Gupta

Automatically Insert a Feed Subscription Note at the Bottom of each WordPress Post

rssfeedTotal number of Feed Subscribers/Readers tells about how much popular a particular blog is. If a blog has large number of feed readers means more people like the blog and they enjoy reading the blog posts.

Adding a feed subscription note at the end of each post can help you in getting more feed subscribers.

You can add a note like this:

If you have enjoyed this post, then you can Subscribe to our RSS feeds!

If reader liked your post he/she will surely using the subscription link, subscribe to your blog feeds. Adding this note manually to each post is a little clumsy task. I will now tell you a trick by which you will be able to automatically insert a subscription note or any other content you want, below each post of your WordPress blog.

How to automatically insert any content at the bottom of each WordPress post

1. You will have to add a code snipped to the functions.php file of your theme.

2. You can either do it in the dashboard itself or via any ftp program. I will recommend to edit function.php file via ftp. Because while editing function.php file in the dashboard if you done any mistake your blog will stop working and you will not be able to undo the changes. So editing function.php via ftp is always recommended.

3. Below are the three versions of code to insert in functions.php. Do take care of the php start and closing tags.

a. Insert in Single Post pages only

<?php
function postFooter($footernote) {
if(is_single()) {
$footernote .= "<p><em>If you have enjoyed this post, then you can ";
$footernote .= "<a href='http://feeds.feedburner.com/theitechblog' title='TheitechBlog RSS Feed'>Subscribe to our RSS feeds</a>!</em></p>";
}
return $footernote;
}
add_filter ('the_content', 'postFooter');
?>

b. Insert in Feeds only

<?php
function postFooter($footernote) {
if(is_feed()) {
$footernote .= "<p><em>If you have enjoyed this post, then you can ";
$footernote .= "<a href='http://feeds.feedburner.com/theitechblog' title='TheitechBlog RSS Feed'>Subscribe to our RSS feeds</a>!</em></p>";
}
return $footernote;
}
add_filter ('the_content', 'postFooter');
?>

c. Insert in both Single Post Pages and Feeds

<?php
function postFooter($footernote) {
if(is_single() || is_feed()) {
$footernote .= "<p><em>If you have enjoyed this post, then you can ";
$footernote .= "<a href='http://feeds.feedburner.com/theitechblog' title='TheitechBlog RSS Feed'>Subscribe to our RSS feeds</a>!</em></p>";
}
return $footernote;
}
add_filter ('the_content', 'postFooter');
?>

Note: Do change my feed url with yours.

If you would like to add something else, replace the content between double quotes in the following code:

$footernote .= " //insert here ";

Related: Turn your Blog Commenters into RSS Feed Subscribers [WordPress]

Feel free to comment-in your problems and queries.

  • Nice and simple tip.

    Thanks for this.

  • mohammad

    really nice and simple tips
    thnaks gupta brother. you are welcome to my tech blog ;)