Pure Code Implementation WordPress Comment reply automatically add @ Reviewer's function

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.