打开 DUX
主题的 functions.php
文件,在最后一个 ?>
的前面添加以下代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
//私密评论 function liao_private_message_hook( $comment_content , $comment){ $comment_ID = $comment->comment_ID; $parent_ID = $comment->comment_parent; $parent_email = get_comment_author_email($parent_ID); $is_private = get_comment_meta($comment_ID,'_private',true); $email = $comment->comment_author_email; $current_commenter = wp_get_current_commenter(); if ( $is_private ) $comment_content = '#私密# ' . $comment_content; if ( $current_commenter['comment_author_email'] == $email || $parent_email == $current_commenter['comment_author_email'] || current_user_can('delete_user') ) return $comment_content; if ( $is_private ) return '<span style="color:#A6A6A6"><i class="fa fa-lock fa-fw"></i>该评论为私密评论</span>'; return $comment_content; } add_filter('get_comment_text','liao_private_message_hook',10,2); function liao_mark_private_message( $comment_id ){ if ( $_POST['is-private'] ) { update_comment_meta($comment_id,'_private','true'); } } add_action('comment_post', 'liao_mark_private_message'); |
然后打开评论配置文件,加入:
效果如下:
看看可不可用
有病?什么叫骗回复?伸手党有理?
看看
@私密@ 私密评论
没有闭标签,不知所用主题是什么样子的
终于看到一个不太一样的内容
特地来试试
特地来试试
这个不错
特地来试试
@掰玉米的小猴子 哈哈,是不是可以?
支持马春杰杰 😛
@刺客 谢谢支持。。