Skip to content

Hide “0 Comments” link in WordPress when using the Disqus Plugin

“Google Fail” posts usually have absolutely nothing to do with what I normally blog about, but are attempts to fill gaps in the mighty collective internet knowledgebase. They are triggered by rare cases where Google has failed me in my search to find some piece of information, or easy instruction on how to do something, and I’ve had to solve the problem myself like in “the olden days” (with hardtack, and liberal application of cholera).

I’ve been using the excellent “Disqus” WordPress plugin for a number of websites, but have been increasingly frustrated that there didn’t appear to be an easy way to modify the shorthand comment count links that appeared in the themes (usually “0 Comments”, “1 Comment”, or “# Comments”). Traditionally in WordPress this would be done through simply modifying the comments_popup_link function in the theme. However because Disqus overwrites this link any customization to this function (like not displaying “0 Comments” at all) were ignored.

I tried adapting a little code snippit from this wordpress support forums thread:

<?php $comment_count = get_comment_count($post->ID); ?>

<?php if ($comment_count['approved'] > 0) : ?>(original comments_popup_link code here)<?php endif; ?>

(Because my Disqus synch’s comments with my WordPress installation “just in case” – basically put everything in a big IF statement so that the comments_popup_link is *only* written if at least one “approved” comment exists).

It actually worked pretty well except that it turns out that get_comment_count (and a lot of wordpress comment functionality) counts trackbacks and pingbacks towards comment totals. So even with “0 Comments”, a lot of posts had a $comment_count > 0. Yes there are customizations and plugins to deal with this – but that’s not exactly an elegant fix at that point (not that anything I do is usually ever “elegant”).

So what’s the solution?

Finally I had the head-smacking realization that if you just log into your dashboard on Disqus, select the “Settings” tab, and the “Appearance” category – voila – there is a “comment count link” section at the bottom that let’s you set custom text for “Zero Comments”, “One Comments” or “Multiple Comments”. And (facepalm) these settings are propagated to your WordPress site.

One final hurdle is that Disqus doesn’t seem to let you set the “Zero Comments” field to hide (in fact entering no value caused a pretty scary error message). But you can set that field to, the webmasters favourite hack: “&nbsp;” (a non breaking space) – which effectively hides the “0 Comments”.

See what I mean about not exactly being “elegant”? Shut up. It works.

  • http://www.facebook.com/AndyFerrisMusic Andrew David Ferris

    I’m having the same problem with my website http://www.andrewferris.com
    Can anyone help me please?

  • http://www.bradfox.com Brad Fox

    Hi Andrew, you don’t seem to be using Disqus to power your comments so none of this will be particularly applicable. If you’re looking to hide the comments counter, that will require editing your theme directly – your theme author might have a comments or support section directly (or you could ask at WordPress.org forums, just make sure to be very clear about what plugins and themes your blog is running and what you’re trying to accomplish).

  • http://cam.vc/ Cam

    Nice :) Disqus really is way ahead with it’s commenting platform. I am starting to feel as thought sites without it seem a bit behind :p Great little trick! Thanks!

  • http://www.biztechconsultancy.com/magento-development.htm Magento Development

    This was the must needed post for me. Thanks a lot for this helpful post which helps me a lot and others as well. Nice sharing.

  • http://www.facebook.com/AndyFerrisMusic Andrew David Ferris

    Thank you so much, I cracked it now!

  • http://myprettyblog.com/ Pretty Trae

    This doesn’t work. :/ I had really hoped it would. Sigh…

  • http://www.bradfox.com Brad Fox

    Your website doesn’t use Disqus for comments so none of this will be applicable to you, unfortunately.

  • http://myprettyblog.com/ Pretty Trae

    Yes, it does. Have you viewed my website..? http://myprettyblog.com

  • http://myprettyblog.com/ Pretty Trae

    And why would I be looking for a way to ‘hide disqus comment count’ if I’m not using disqus to begin with?? *scratching head*

  • http://www.bradfox.com Brad Fox

    Sorry, I didn’t see it underneath the facebook plugin (whose width seems to breaking your design at least on Firefox and iOS – you might want to look at forcing it to 500px or so in the plugin settings).

    I have no idea why people who don’t use Disqus would come here to comment but if you read the thread it’s a pretty common issue for some reason.

    Having multiple comment plugins could be part of the problem on your site (I have no way of knowing how the two interact with each other and WordPress) – but see the comments below from “Angel” if you disable “2012 interface mode” you can sometimes re-set the comment settings and then re-enable “2012 interface” – and still get the result your looking for.

  • http://myprettyblog.com/ Pretty Trae

    It’s okay. Thank you for the info. That was helpful.

  • gilmarzinho

    Thank you!

  • Mona Ali
  • http://www.askdiana.net/ Sarah Lee

    I really enjoyed reading your article. I found this as an informative and interesting post, so i think it is very useful and knowledgeable. I would like to thank you for the effort you have made in writing this article.

    edupdf.org

  • http://www.friv2468.com friv2468

    Those of the interesting information you always bring out the best that I know, thanks.

  • Abhay Udgire

    Nice post it works for me thank you.

  • Maman Seo

    tnq so much bradfox ,information that is very valuable to me ! good luck and verygood website دانلود فیلتر شکن

  • Vild

    This is A usuful trick , thank you for notification and i wil try to use it min my site , you can take a look there also : Bon Prix Tunisie

  • roknnagd

    Good post this ….

  • http://www.educhatforums.com Fahim Zada

    Online girls chat rooms join for free no registration needed :)
    Chat Rooms
    Pakistani chat rooms

  • Usama Arshad

    Just what I was looking for. Appreciate that you jot down this as I was banging my head against wall trying to edit core PHP files of Disqus.

  • http://freetoolzzz.com Jon Frost

    Thanks!

  • http://www.pony-games.net Pony

    Thanks! I love my little pony friendship pony games

  • http://www.abcya4.com frivcu

    This is A usuful trick , thank you for notification and i wil try to use it min my site

  • http://poltora.info Олег Полторацкий

    Great! Thanks so much. But just right now, I’ve found, that this discus’s page doesn’t work. How do you think, it is temporary or they’ve changed configuration?

  • http://researchteacher.com/ Nick

    So it worked to eliminate the “0 Comments” text, but I’m still left with a blue square that links to the comments in the post. http://www.patientambition.com Any way to totally eliminate the box? I have Disqus on two sites with the same theme, on the other one the comments counter is gone, I don’t remember doing anything with Disqus settings on that one though.

  • Bed Bugs Beyond

    Build a house of plywood or cedar will make an excellent choice for construction .

  • https://www.atonibai.com/ Ato ni Bai

    I have waiting 5-10minutes after making changes to   but not sure, its not working on my site: https://www.atonibai.com/