我正在我的网站上使用Disqus。我使用的主题在每篇帖子上都显示了评论数量,但它只显示默认的WordPress评论系统数量。如何将其与Disqus集成,以便注释计数显示Disqus注释?
这是我的网站-http://tophistorie.pl
我正在我的网站上使用Disqus。我使用的主题在每篇帖子上都显示了评论数量,但它只显示默认的WordPress评论系统数量。如何将其与Disqus集成,以便注释计数显示Disqus注释?
这是我的网站-http://tophistorie.pl
Integrating Disqus Into WordPress Without a Plugin As we discussed earlier, doing stuff without plugins helps us optimize our website - a single query is a single query, right? Anyways, here are the functions that we\'re going to use - like always, add these inside your theme\'s functions.php file: Embedding Disqus Comments
function disqus_embed($disqus_shortname) {
global $post;
wp_enqueue_script(\'disqus_embed\',\'http://\'.$disqus_shortname.\'.disqus.com/embed.js\');
echo \'<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_shortname = "\'.$disqus_shortname.\'";
var disqus_title = "\'.$post->post_title.\'";
var disqus_url = "\'.get_permalink($post->ID).\'";
var disqus_identifier = "\'.$disqus_shortname.\'-\'.$post->ID.\'";
</script>\';
}函数非常简单:使用代码<?php disqus_embed(\'myexampleblog\'); ?>
在你的单身生活中,你想去哪里就去哪里。php和页面。php文件嵌入并显示该页面的Disqs注释。您可以搜索comments\\u template();函数并将其替换为新函数,因为我们不再使用本机注释函数。
出于某种原因,我的Discus评论系统似乎将主页上的评论计数重置为0。如果您加载my site 当前顶部的博客有1条评论,你可以看到它简短地写着1,然后变为0。刷新页面,如果找不到,请密切关注。我不知道它为什么这样做。如果单击博客阅读,评论计数将正确显示1。此外,关于VPN的第三个博客在主页上读到0条评论,当你点击它时读到0条评论,即使它有评论。有人能提出解决方案吗?编辑插件link.