导读:网站搭建网站搭建说到这个wordpress 回复可见的功能,小编早在多年前就尝试过,但是会有一些问题,比如使用多说导致回复后,不能立刻显示内容,所以就取消了这个功能,但是如果是技术网站网站怎么搭建。

说到这个wordpress回复可见的功能,小编早在多年前就尝试过,但是会有一些问题,比如使用多说导致回复后,不能立刻显示内容,所以就取消了这个功能,但是如果是用wordpress自带评论模块的话,那么这个功能,可谓是秒回秒可见哈!
下面我们直接说教程吧
这块,我就不推荐大家用什么插件了。完全加入代码即可OK!
在wordpress主题文件的functions.php内加入以下代码:
function?reply_to_read($atts,?$content=null)?{
????????extract(shortcode_atts(array("notice"?=>?'<p?class="reply-to-read">温馨提示:?此处内容需要<a?href="#respond"?title="评论本文">评论本文</a>后才能查看.</p>'),?$atts));
????????$email?=?null;
????????$user_ID?=?(int)?wp_get_current_user()->ID;
????????if?($user_ID?>?0)?{
????????????$email?=?get_userdata($user_ID)->user_email;
????????????//对博主直接显示内容???
????????????$admin_email?=?"xxx@aaa.com";?//博主Email???
????????????if?($email?==?$admin_email)?{
????????????????return?$content;
????????????}
????????}?else?if?(isset($_COOKIE['comment_author_email_'?.?COOKIEHASH]))?{
????????????$email?=?str_replace('%40',?'@',?$_COOKIE['comment_author_email_'?.?COOKIEHASH]);
????????}?else?{
????????????return?$notice;
????????}
????????????return?$notice织梦模板免费;
????????}
??dede手机模板??????global?$wpdb;
????????$post_id?=?get_the_ID();
????????$query?=?"SELECT?`comment_ID`?FROM?{$wpdb->comments}?WHERE?`comment_post_ID`={$post_id}?and?`comment_approved`='1'?and?`comment_author_email`='{$email}'?LIMIT?1";
????????if?($wpdb->get_results($query))?{
????????????return?do_shortcode($content);
????????}?else?{
????????????return?$notice;
????????}
关键词标签: WordPress 方法 div
声明: 本文由我的SEOUC技术文章主页发布于:2023-07-23 ,文章wordpress回复可见的实现方法,网站搭建主要讲述方法,div,wordpress网站建设源码以及服务器配置搭建相关技术文章。转载请保留链接: http://www.tngdez.cn/article/web_35307.html