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.

  • Anonymous

    Hey, Your article.This information is obviously a
    great job. Thanks for the valuable information and knowledge that have
    forever here. Keep it up!
     

  • http://www.diigo.com/user/quinones Kira Proctor

    I really loved this post. You describe this topic perfectly. Great looking website really.

  • http://slide2gameplay.0fees.net/ Slide2Gameplay

    how can i hide disqus on specific page in wordpress
    OR
    show disqus only on posts in wordpress

  • http://www.facebook.com/profile.php?id=566409224 Andrea Ballatore

    Do you know how to customise the “Showing X comments”  label?

  • tinkererguy

    I noticed it took about 5 minutes for the change to Disqus to take effect on my site, but then, it worked!

    Minor nit:  I noticed if I hit F5 refresh on my page, tinkertry.com, , I can briefly see “0 comments” which it then quickly hides, not really a problem, it’s a momentary thing (happens in IE/Firefox/Chrome).

    However, I seem to have the little comment bubble comments.png show up, even for 0 comments pages.  Not a bit deal, just figured I”d ask if anybody figured out an easy/elegant way to discard those as well.  Tweak to postinfo.php or something?

  • http://www.superspeedlearning.com/forkids/ Mental Math

    Whenever disqus release a new version the downtime sucks but it would work fine after that. 

    However, I’ve read on another blog that disqus is selling users’ data to third party. That would be a big #fail. I hope they don’t do that

  • http://www.fivegroups.com/ Comics

     
    It is possible to find these old and rare collectible comics on eBay, but you should note that the bidding is always fierce. As a buyer, you should also note that the quality of these comics is generally a guessing game. You can also find other sites with a wide range of books which are not only indexed in alphabetical order, but also provides the grade for the condition of the book. There is also a Superman #4 for sale with a price $495 in fair condition. A lot of the comic books on some of these sites are below $50. Perhaps the most expensive comic for Superman is ranked #7 with very good condition and priced at $795. There is also Superman #291 in poor condition, plus it’s a Mexican copy selling for $2

  • http://careerology.co.nz Jonathan Moy

    Thanks for the nbsp; tip!

  • http://www.freeso.org Freeso

    Fantastics Advice, I have found the solution for time, Really thank you blogger

  • http://species.com/category/species-categories/indigenous-species indigenous species

    Hi,
    Very informative article. I’m gonna use this one for sure.Keep sharing continue.

  • http://www.homelivingstyle.com/Bathroom_Vanity_Cabinets_s/636.htm sink cabinets

    Wow!This is a great summary of simple action items that marketers ought to
    enforce to keep their working.Keep writing continue.

  • 154443
  • http://www.whitelotusliving.com//blueair-clean-air-purifier-c211.html blueair

    Wow!This is good info. I was getting ready to switch over one of my sites to Disqus.Well done.Keep sharing continue.

  • http://patentsbase.com/items/US-5761103-A-left-and-right-justification-of-single-precision-mantissa-in-a-double-precision-rounding-unit Left and right justification

    Wow!This is good info. I was getting ready to switch over one of my sites to Disqus.Well done.

  • http://www.therapies4all.com/Alexander-technique.htm alexander technique

    Thanks!Very informative and well written article. It contains lot of info. Thanks for sharing.

  • Anonymous

    I tried this, disqus is installed and works, but I still see “0 comments” in my posts and blogs etc. I put in the “ ” in the zero comments field and it still says “0 comments” please assist. http://www.djshorte.com scroll down to see the problem in my posts.

  • http://www.intimatease.com/ corset

    Wow!This is good info. I was getting ready to switch over one of my sites to Disqus.Well done.Keep sharing continue.

  • http://seowebtrick.com/ seo company Jhansi

    Woooo! This is great! I’m loving it. Is there a place where I can share
    mine. You’re doing a great job. You really have a future ahead of you!
    Can’t wait to read more! Thanks!

  • Hamza Sajjad

    wow……! good job

  • http://baljitdhanoa.wordpress.com/ baljit dhanoa

    Using Disqus with your website gives you a fully-featured comment
    system, social network integrations, advanced administration and
    moderation, and other extensive community functionality. Most
    importantly, with Disqus your website is plugged into a web-wide
    community network, connecting millions of global audiences to your small
    blog or large media hub.
     

  • http://www.buy-premium-themes.com/ wordpress themes

    They triggered a rare case, Google has not in my search, I found some of the information sheet, or how easy instructions, I have solved the problem, its like in the past.

  • http://cmro.travis-starnes.com/ Travis

    Of course, you can see from the comments in this article that having Disqus you do tend to get a pretty large portion of spanners telling you how you should keep it up with a link to something crazy.

  • http://quieroserblogger.com Carlos Tinca

    Thanks, i didnt notice of that function of Disqus.

  • http://www.coolcreation.co.uk/ Website design

    Presentation of a website is a crucial factor that the developer or owner must think about. The look of a website depends much on the design of it. Therefore, website design has become a matter of huge importance for the website designers or developers.

blog comments powered by Disqus