First look at the effect:
What's the use of this? After adding the @ feature, the hierarchical relationship between those user reviews is clear, and we can clearly see who sent the comments to whom. In fact, mainly to enhance the force lattice.
Implementation method:
Add the following code to the function.php
123456789 |
//为你的评论回复添加@功能
function shenjie_com_comment_add_at(
$comment_text
,
$comment =
‘‘
) {
if
(
$comment
->comment_parent > 0) {
/*下面这句代码中的color你可以自定义*/
$comment_text =
‘<a style="color: #388e3c;" href="#comment-‘ .
$comment
->comment_parent .
‘">@‘
.get_comment_author(
$comment
->comment_parent ) .
‘</a> ‘ .
$comment_text
;
}
return $comment_text
;
}
add_filter(
‘comment_text‘ ,
‘shenjie_com_comment_add_at‘
, 20, 2);
|
But I first test this code when I found that this feature has not been implemented, and finally I stopped using wp-useragent this plugin after the success, that is, this feature and Wp-useragent plugin is a conflict, although wp-useragent inside has advanced settings, But I changed some of the code is still not working, so I finally decisively give up this function, but if you do not use wp-useragent this plugin, you can still try the above function, or pretty good
Pure Code Implementation WordPress Comment reply automatically add @ Reviewer's function