给自己的WordPress添加一个简洁的评论回复邮件模板,让用户收到来自你网站的回复邮件通知的时候也感受到你的小清新。废话不多了开始动手 把下面代码放到functions.php里,?>之前,(P.S. 如果之前有评论回复邮件的话,就把它覆盖掉) [cc lang=\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\”php\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\”] //评论回复邮件 function comment_mail_notify($comment_id) { $comment = get_comment($comment_id); $parent_id = $comment->comment_parent ? $comment->comment_parent : \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’; $spam_confirmed = $comment->comment_approved; if (($parent_id != \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’) && ($spam_confirmed != \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’spam\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’)) { $wp_email = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’no-reply@\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ . preg_replace(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’#^www\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\.#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’, \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’, strtolower($_SERVER[\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’SERVER_NAME\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’]));//发件人e-mail地址 $to = trim(get_comment($parent_id)->comment_author_email); $subject = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’您在 [\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ . get_option(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\”blogname\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\”) . \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’] 的留言有了回應\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’; $message = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’> 您在 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ . get_option(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’blogname\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’) . \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ 博客上的留言有回复啦!\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ . trim(get_comment($parent_id)->comment_author) . \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ 同学,您曾在文章《\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ . get_the_title($comment->comment_post_ID) . \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’》上发表评论:\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ . nl2br(get_comment($parent_id)->comment_content) . \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ . trim($comment->comment_author) . \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ 给您的回复如下:\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ . nl2br($comment->comment_content) . \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’您可以点击 查看回复的完整內容 ,欢迎再次光临 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ . get_option(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’blogname\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’) . \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ 。\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’; $from = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\”From: \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\”\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\” . get_option(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’blogname\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’) . \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\”\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\” \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\”; $headers = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\”$from\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\nContent-Type: text/html; charset=\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\” . get_option(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’blog_charset\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’) . \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\”\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\”; wp_mail( $to, $subject, $message, $headers ); //echo \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’mail to \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’, $to, \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ , $subject, $message; // for testing } } add_action(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’comment_post\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’, \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’comment_mail_notify\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’); [/cc] 正文到此完结。

相关新闻

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

联系我们

联系我们

151-1101-0018

在线咨询:< a href="https://wpa.qq.com/msgrd?uin=30115776" target="_blank" rel="noopener noreferrer">点击这里给我发消息</ a>

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信
关注微信
分享本页
返回顶部