導讀:網(wǎng)站搭建網(wǎng)站搭建說到這個wordpress 回復可見的功能,小編早在多年前就嘗試過,但是會有一些問題,比如使用多說導致回復后,不能立刻顯示內(nèi)容,所以就取消了這個功能,但是如果是技術(shù)網(wǎng)站網(wǎng)站怎么搭建。

說到這個wordpress回復可見的功能,小編早在多年前就嘗試過,但是會有一些問題,比如使用多說導致回復后,不能立刻顯示內(nèi)容,所以就取消了這個功能,但是如果是用wordpress自帶評論模塊的話,那么這個功能,可謂是秒回秒可見哈!
下面我們直接說教程吧
這塊,我就不推薦大家用什么插件了。完全加入代碼即可OK!
在wordpress主題文件的functions.php內(nèi)加入以下代碼:
function?reply_to_read($atts,?$content=null)?{
????????extract(shortcode_atts(array("notice"?=>?'<p?class="reply-to-read">溫馨提示:?此處內(nèi)容需要<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;
????????????//對博主直接顯示內(nèi)容???
????????????$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;
????????}
????????if?(empty($email))?{
????????????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;
????????}
關(guān)鍵詞標簽: WordPress 方法 div
聲明: 本文由我的SEOUC技術(shù)文章主頁發(fā)布于:2023-07-23 ,文章wordpress回復可見的實現(xiàn)方法,網(wǎng)站搭建主要講述方法,div,wordpress網(wǎng)站建設源碼以及服務器配置搭建相關(guān)技術(shù)文章。轉(zhuǎn)載請保留鏈接: http://www.bifwcx.com/article/web_35307.html