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 () 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 /
- 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:
Make sure you have the correct feed-icon (you can get them here) in the <your*//img *folder.
You might also want to change your
Here’s the final result:
All in all, I’m finding WordPress to be very easy to enhance and extend. This change allowed me to offer my readers an easy to recognize way to subscribe to my comments’ RSS feeds.
I hope this helps.