Question

i have installed Disqus comment system on one of my wordpress blogs, but i want the comment numbers to show as 0 instead of 0 Comments or 12 instead of 12 Comments. Previously there used to be an Appearance section in Disqus admin that used to have an option to change this output as was suggested in answer to this question. But seems like the Appearance section has been taken off by Disqus. Is there any other way to achieve this (without messing with the plugin code, ofcourse.) ??

UPDATE:

Well, looked into the plugin source as well but no use, seems like they are updating it using javascript. After enabling Reactions now it returns 0 comments and 0 Reactions.

UPDATE#2:

okie so i at last found where it is coming from ... the plugin basically includes a count.js files from yoursite.disqus.com\count.js?some wierd parameters, and the js file looks something like this:

var DISQUSWIDGETS;

if (typeof DISQUSWIDGETS != 'undefined') {
    DISQUSWIDGETS.displayCount({"showReactions": true, "text": {"and": "and", "reactions": {"zero": "0 Reactions", "multiple": "{num} Reactions", "one": "1 Reaction"}, "comments": {"zero": "0 Comments", "multiple": "{num} Comments", "one": "1 Comment"}}, "counts": [{"reactions": 0, "uid": 1, "comments": 0}, {"reactions": 0, "uid": 0, "comments": 0}, {"reactions": 0, "uid": 3, "comments": 0}, {"reactions": 0, "uid": 2, "comments": 0}, {"reactions": 0, "uid": 4, "comments": 0}]});
}

the worst part is we can't even change the code in the js file as it is hosted on disqus itself.

Was it helpful?

Solution

You should be able to hide it via JavaScript.

Something along these lines:

node = document.getElementsByClassName("dsq-comment-count")[0].childNodes[0]
node.nodeValue = node.nodeValue.replace("Comments", "")

OTHER TIPS

Alternatively you can "hack" the code of Disqus. I'll try to explain what I did step-by-step:

  1. Get the newest file of the main disqus function. It should be something similar to this: http://disqus.com/forums/(your-site-id)/count.js
  2. Copy that script somewhere, you can "beautify it" to make it more readable. Than find and change the displayCount function to whatever you want to like this:

    c.displayCount = function (a)
    {
      for (var b, c, e, g, f = 0; f < a.counts.length; f++)
      if (b = a.counts[f], c = h[b.uid]) e = b.comments === 0 ? "0 drivels" : b.comments == 1 ? "1 drivel" : "{num} drivels",
      g = e.replace("{num}", b.comments),
      a.showReactions && (e = b.reactions === 0 ? a.text.reactions.zero : b.reactions == 1 ? a.text.reactions.one : a.text.reactions.multiple, e !== "" && (g += " " + a.text.and + " " + e.replace("{num}", b.reactions))),
      c.element.innerHTML = g
    };
    

    (note the drivels ;)

  3. Save (upload) the whole file somewhere on your server and remember the path

  4. Use Wordpress administration to edit the Disqus plugin - file disqus-comment-system/disqus.php and find line that contains concatenated url withthe word count.js. It is in about 3/4 of the file. As of now the line looks like this but it might change in the future:

    s.src = '//' + '<?php echo DISQUS_DOMAIN; ?>/forums/' + disqus_shortname + '/count.js';
    
  5. Make this link point to your newly-uploaded file like this (I used relative URL):

    s.src = '/wp-include/custom/disqus-count.js';
    
  6. Save it and profit! It took me more than an hour to figure this out so I hope this actually helps someone (I needed to translate these messages into my native language). A great benefit of this approach is the fact that if your language uses different word forms for different numbers (other than 0, 1 and more), you can script it in.

The official answer is here: http://help.disqus.com/customer/portal/articles/565624#customizing-link-text

  1. Go to http://YOUR-SITE.disqus.com/admin/settings/?p=general

  2. Edit Comment Count Link section as you need.

  3. That's all!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top