HidePost|隱藏內文限定使用者瀏覽

外掛名稱:HidePost(隱藏內文限定使用者瀏覽)
外掛版本:2.3.8 ( 相容性對應到 WordPress  3.0.4 )
下載網址:http://wordpress.org/extend/plugins/hidepost/

這套外掛可以讓文章中的部份內容讓特定的瀏覽族群觀看,外掛安裝並啟用後至外掛設定中勾選 Enable Hidepost 就可開始使用此功能,只要在文章插入 [ hidepost ]本文限定註冊者瀏覽[ /hidepost ] 標籤就可以讓該片段內容只讓使用者看到,如果想要是更詳細的限定的話可以用[ hidepost=等級參數 ]本文限定特定使用者瀏覽[ /hidepost ] 標籤來設定。

等級參數如下:
10 => 管理員
7 => 編輯
2 => 作者
1 => 撰寫人員
0 => 訂閱者

所以如果想讓編輯以上的人看的話就輸入 [ hidepost=7 ]本文限定特定使用者瀏覽[ /hidepost ] 即可。

0 0 votes
Article Rating
Subscribe
Notify of
5 Comments
Inline Feedbacks
View all comments
豪豪
13 years ago

太感謝你了,我試試^_^

老彰
12 years ago

好東西,但是我比較想詢問”隱藏部分內文,限定{回響者}瀏覽”

老彰
12 years ago

後者做不出來也是在意料中…但前者我很感興趣

老彰
11 years ago

隱藏部分內文,限定{回響者}瀏覽 wordpress可以做到!

—-以下內容加入到functions.php文件中—

function reply_to_read($atts, $content=null) {
extract(shortcode_atts(array(“notice” => ‘溫馨提示: 次處內容需要評論本文後才能觀看.’), $atts));
$email = null;
$user_ID = (int) wp_get_current_user()->ID;
if ($user_ID > 0) {
$email = get_userdata($user_ID)->user_email;
//對管理員直接顯示
$admin_email = “[email protected]”; //管理員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;
}
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;
}
}

add_shortcode(‘reply’, ‘reply_to_read’);

以上,自行修改管理員email的地址
使用方法是:編輯文章在文章內添加 [reply]隱藏的文字[/reply]