I can track the comments on a specific post using the post_comments_rss_link() template tag:
<?php comments_rss_link('RSS 2.0'); ?>
But I can't figure out how to replace the HTML text link 'RSS 2.0' with an image.
I can track the comments on a specific post using the post_comments_rss_link() template tag:
<?php comments_rss_link('RSS 2.0'); ?>
But I can't figure out how to replace the HTML text link 'RSS 2.0' with an image.
http://codex.wordpress.org/Function_Reference/post_comments_feed_link
<?php post_comments_feed_link( $link_text = '<img src="yourimage">') ?>
The Codex is a wonderful tool.
Originally, when I tried
<?php post_comments_feed_link( $link_text = '<img src="<?php bloginfo('template_url'); ?>/images/content/rss.png" width="42" height="25" alt="RSS" />') ?>
I got the following error:
PHP Parse error: syntax error, unexpected T_STRING
I believe this is because my image path contains PHP:
img src="<?php bloginfo('template_url'); ?>/images/content/rss.png"
But the following workaround seems to work:
<?php $themePath = get_bloginfo('template_url'); ?>
<?php $imagePath = '<img src="' . $themePath . '/images/content/rss.png" width="42" height="25" alt="RSS" />'; ?>
<?php post_comments_feed_link( $link_text = $imagePath) ?>@mdziedzic, this is exactly what I was looking for. Thanks for posting it!
This topic has been closed to new replies.