【问题标题】:Hide Disqus on password-protected posts until password is entered?在输入密码之前隐藏受密码保护的帖子上的 Disqus?
【发布时间】:2012-08-26 16:39:08
【问题描述】:

我需要在受密码保护的帖子上隐藏 Disqus cmets,直到用户输入正确的密码。我已经就这个问题联系了 Disqus……首先他们告诉我启用 disqus_developer 变量。所以我在 Wordpress 的 header.php 中添加了这个:

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

但这并没有做任何事情。然后 Disqus 支持告诉我:

您必须在不加载 Disqus 的代码中添加一些逻辑 除非输入密码。这是你需要做的事情 在您的主题/模板中自定义。

他们没有就如何实现这一点给出任何指示。我需要做什么?

【问题讨论】:

标签: wordpress password-protection disqus


【解决方案1】:

只需编辑 plugins/disqus-comment-system/cmets.php 并在该文件开头的某处添加以下代码:

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

【讨论】:

  • 你是互联网上最好的东西。谢谢。
猜你喜欢
  • 2012-03-07
  • 1970-01-01
  • 1970-01-01
  • 2021-01-27
  • 2018-04-30
  • 2013-08-19
  • 1970-01-01
  • 2011-12-23
相关资源
最近更新 更多