人氣 5680°c

Disqus評論加上顯示隱藏按鈕

Disqus評論是WordPress第三方留言外掛,現時也有很多個人或大型網站所使用的評論功能,不過!如果你的博客(Blog)或網站,並不是那麼多訪客留言,這樣建議Disqus加上顯示/隱藏的開關按鈕。

當瀏覽者想回文的時候,只要點擊開關按鈕,才載入Disqus評論。

打開主題目錄,修改「single.php」文件。

加入以下代碼:
<div id="mo_disqus_onclick">開關 :-) 留言板</div>
<div id="hidden-wrapper-div" style="display:none">
<div id="disqus_thread"></div>
</div>

打開主題目錄,修改「footer.php」文件。

加載JQuery庫:

<script type="text/javascript">
$j=jQuery.noConflict();
$j(document).ready(function() {
$j('#mo_disqus_onclick').on('click', function(){ // click event of the show comments button
var disqus_shortname = '請填入ShortName'; // Enter your disqus user name
// ajax request to load the disqus javascript
$j.ajax({
type: "GET",
url: "http://" + disqus_shortname + ".disqus.com/embed.js",
dataType: "script",
cache: true
});
$j('#hidden-wrapper-div').toggle(); // remove the show comments button
});
});
</script>

完成...

如果!博客的主題欠缺Jquery庫,你可以調用官方的Jquery CDN URL 請按此去!

什麼是ShortName!?
按此處查看Disqus Shortname 教學...

原文: 請輕輕地按!

預覽效果Demo▼

相關文章:
1. Disqus最新評論JS調用碼
2. Disqus隱藏迴響已被關閉(評論已被關閉)
3. Disqus Around The Web廣告關閉
4. Twenty Twelve Disqus留言(发表回复)按鈕無反應#respond
5. Disqus留言外掛手動獨立安裝-加速唷!
6. Disqus關閉訪客留言(遊客評論)
7. 禁止內容的超連結(鏈接)自動解析
標籤: ,