How to: Suggest your visitors to leave comments in your rss feed

February 16, 2009 at 8:43 am

Most bloggers like to receive comments about their posts. Here is a cool recipe to display a message on your rss feed, notifying your visitors that the discussion is open and suggesting them to comment.

Additionally, when using WordPress as CMS, sometimes it is necessary to create new posts instead of pages for static pages because you want them to appear in the RSS feed. You may not want to enable comments inside those posts.

At other cases, you may also want to selectively choose to enable and disable comments. The problem is, how do you prevent your RSS feed subscribers from clicking with the intention to leave comment while the comment is disabled?

How about giving them a clue at the end of the post? To achieve this recipe, just put the following code in the functions.php file within your active theme:

function rss_comment_footer( $content ) {
    if ( is_feed() ) {
        if ( comments_open() ) {
            $content .= "\n\nComment is open. You can participate in the discussion
by visiting <a href='".get_permalink()."'>here</a>\n";
        }
    }   
    return $content;
}

Thanks to Hendry Lee for submitting this recipe!