2012-08-31 42 views
1

我需要在受密碼保護的帖子上隱藏Disqus評論,直到用戶輸入正確的密碼。我已經與Disqus就此進行了聯繫......首先他們告訴我啓用disqus_developer變量。所以我把它添加到Wordpress中的header.php中:在密碼保護的帖子中顯示Disqus,直到輸入密碼爲止?

<script type="text/javascript"> 
var disqus_developer = 1; // developer mode is on 
</script> 

但是這並沒有做任何事。然後,Disqus支持對我說:

你將不得不一些邏輯添加到您的代碼,除非輸入密碼不加載Disqus 。這是您需要在您的主題/模板中自定義的 。

他們沒有給出如何實現這一目標的方向。我需要做什麼?

+0

我想補充,'disqus_developer'是[不再支持的配置可變](http://help.disqus.com/customer/portal/articles/472098-javascript-configuration-variables)。有關替代方法,請參閱http://help.disqus.com/customer/portal/articles/1053796-best-practices-for-staging-development-and-preview-sites。 – iain

回答

1

只要編輯插件/ disqus註釋系統/ comments.php文件和地方在該文件的開頭添加以下代碼:

<?php if (post_password_required()) { ?> 
<p class="nocomments">Whatever text you want.</p> 
     <?php 
       return; 
     } ?> 
+0

你是互聯網上最好的東西。謝謝。 – loveunderlined