Thanks for sharing, Uwe. The identical “no link to a comment page” problem has WP-RecentComments widget. To tell the truth, it would be nice to hear a miracle cure from You. :)
Hi toto,
I took a brief look at WP-RecentComments and guess you mean the incorrect comment links.
I glanced over the code and found the culprit in core.php (starting at line 119). The plugin simply assumes that all comments are on the same page — it doesn’t even use WordPress’ get_comment_link function. This should be rather easy to fix; I suggest you contact the author of that plugin about this and send him or her a link to this page.
if ($comment->comment_type == 'pingback') { // line 119
$result .= '<li id="rc_item_' . ++$count . '" class="rc_item rc_pingback">' . sprintf('<div class="rc_info"><span class="rc_label">' . __('Pingback:') . '</span> %1$s</div>', get_comment_author_link()) . '</li>';
} else if ($comment->comment_type == 'trackback') {
$result .= '<li id="rc_item_' . ++$count . '" class="rc_item rc_trackback">' . sprintf('<div class="rc_info"><span class="rc_label">' . __('Trackback:') . '</span> %1$s</div>', get_comment_author_link()) . '</li>';
} else if ($args['post'] == 'true') {
$result .= '<li id="rc_item_' . ++$count . '" class="rc_item">' . $element_avatar . sprintf('<div class="rc_info"><span class="author_name">%1$s</span> ' . __('on', 'wp-recentcomments') . ' <span class="post_title">%2$s</span></div>', get_comment_author_link(), '<a href="'. get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '">' . get_the_title($comment->comment_post_ID) . '</a>') . '<div class="rc_excerpt">' . $comment_excerpt . '</div></li>';
} else {
$result .= '<li id="rc_item_' . ++$count . '" class="rc_item">' . $element_avatar . sprintf('<div class="rc_info"><span class="author_name">%1$s</span>' . rc_get_author_info() . '</div>', '<a href="'. get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '">' . $comment->comment_author . '</a>') . '<div class="rc_excerpt">' . $comment_excerpt . '</div></li>';
}
Uwe
Hi, I was wondering how to display just “in reply to [comment author of parent comment]” on the comments section of my blog?
I tried doing a hack based on your code but I can’t get it done. Any help would be greatly appreciated. :D
Hi Jhay,
this should work by making the changes as described above in wp-includes/comment-template.php at lines 477 and 1264–1269. Did you do that?
Hi, are you using WordPress 3.0.1? It’s the version of WP I am running and I can’t implement the changes to the core code because they are different from what is in my WP core files.
Hi Jhay,
I have to admit that I’m still running WordPress 2.9.1. Hence, the line numbers are probably different in your case, but it should be possible to find the place in the code where the relevant parts have been relocated. The more important question is whether WordPress has changed its behavior in this regard. This may be the case, according to this:
Change to comments UI to show when a comment is replying to another, and link to the parent commentHave you seen these parent comment links on other WordPress sites?
I see. Now that you’ve mentioned that changed behavior in WP 3.0, does it mean that the hacks you’ve shown in this post are no longer necessary because they’re ‘built into’ WP 3.0?
This is puzzling because if it were so, how come most WordPress sites don’t display the “in reply to” info in the threaded comments. This is why I searched for code that does that and I landed here in your blog. :D
Hi Jhay,
I see. Now that you’ve mentioned that changed behavior in WP 3.0, does it mean that the hacks you’ve shown in this post are no longer necessary because they’re ‘built into’ WP 3.0?
maybe that’s the case. Try asking about this at the WordPress forums.
This is puzzling because if it were so, how come most WordPress sites don’t display the “in reply to” info in the threaded comments.
Maybe the WordPress themes have to be modified to support this. Are there WordPress 3.0 themes?
Thanks for this. Like you, I write blog posts documenting my changes because I know that when I visit them later I will have no clue about what changed and why. So the post is more for my future self than anything else :)