In working with my custom template for WordPress, I came across an unfortunate problem. It seems that the default output for the function post_comments_feed_link() displays a simple anchor tag with a link to the comment RSS feed.

I like to use the RSS Icon (feed-icon-14x14) to indicate that the feed is, in fact, an RSS feed. It’s easily recognized over just plain text. This is not possible in the default implementation, so I had to do some hacking.

To get the icon on my page, I had to do two things:

  • Edit the **link-template.php **file in //wp-includes folder
  • Edit the style.css file

In link-template.php, search for the function named “post_comments_feed_link()”. Once you find that function, notice that the last line is:

echo apply_filters( ‘post_comments_feed_link_html’, “$link_text”, $post_id, $feed );

Simply change it to the following code:

echo apply_filters( ‘post_comments_feed_link_html’, “<a href=’$url’ id=’CommentRSSLink’>$link_text”, $post_id, $feed );

This will give us an ID to hook up with in our CSS file.

In your styles.css file, simply add the following:

#CommentRssLink
{
background-image: url(‘img/feed-icon-14×14.png’);
background-repeat: no-repeat;
background-position: 0;
height: 14px;
padding-left: 18px;
}

Make sure you have the correct feed-icon (you can get them here) in the <your*/