When you install Disqus in WordPress, you can manually update your template’s code for counting comments. Normally, your WordPress template is configured to display comment count made in the default commenting system. If you uses the universal code for Disqus comments, you will also have to manually add comment counting code as well.
While browsing your website, depending upon your template you will see the comment count of posts in several pages. Texts such as 0 Comments, 10 Comments are displayed in the home page, category page as well as in the post itself. Sometimes they are really stylized and are displayed as one of the highlights of a post. Such texts are linked to the comments section of a post.
To display comment count of Disqus comments made in a WordPress blog:
- Visit https://disqus.com/admin/universalcode/
- Under the heading “How to Display Comment Count” you will find some javascript code. This is the second code present in the page linked above.
- Your code will look something like
<script type="text/javascript"> /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */ var disqus_shortname = 'thisfox'; // required: replace example with your forum shortname /* * * DON'T EDIT BELOW THIS LINE * * */ (function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); </script>
- Copy that code and paste it in your WordPress theme’s footer.php file (wp-content/themes/<theme-name>/footer.php). Paste it before </body> tag.
- Open up your single.php file and edit the code that is displaying comment count and link. In my case the code looks something like:
<a href="<?php comments_link(); ?>"><?php comments_number();?></a>
I change the code to:
<a href="<?php the_permalink(); ?>#disqus_thread">Comments</a>
- Save your changes. Your template file might have implemented WordPress comment count feature differently. Just search the single.php file, index.php, category.php, archive.php for comments_link() and comments_number() functions. Make the appropriate HTML changes like I did above.
Note: Some templates don’t even have the code for comment count. You can add the code that I’ve shown above for such templates. You should surround the code with CSS styled divs to match it with your website.