I'm pretty sure that this can be solved quite easy, but for some reason I just can't get it to work.
My current code looks like this:
<?php $comments = get_comments('status=approve&number=5'); ?>
<ul id="recent_comments">
<?php foreach ($comments as $comment) { ?>
<li><p><strong><?php
$title = get_the_title($comment->post_ID);
echo get_avatar( $comment, '45' );
echo strip_tags($comment->comment_author); ?></strong> commented on <a href="<?php echo get_permalink($comment->post_ID); ?>" rel="external nofollow" title="<?php echo $title; ?>"> <?php echo $title; ?></a>: <?php echo wp_html_excerpt( $comment->comment_content, 45 ); ?> (...)</p></li>
<?php } ?>
</ul>
It works fine, but it only displays the post title and a link to it. I'd like to have the post title displayed, but have it linked directly to the specific comment.
I suppose you'd use something like that:
<a href="<?php echo get_permalink($comment->ID); ?>#comment-<?php echo $comment->comment_ID; ?>" title="on <?php echo $comment->post_title; ?>"></a>
I tried to implement this into the code above somehow. It works, but it suddenly shows the title of a post where the comment doesn't belong to.
Anybody knows how to fix this?
Thanks a lot in advance!