Website Solutions Expert

Fixing View Comments in Disqus Plugin

I’ve made no secret of the fact I love the Disqus commenting system plugin. However each time I upgrade it I have to go through the same rigmarole of changing the plugin due to one specific problem. So this will explain how I fix the View Comments problem in the Disqus plugin for WordPress.

Update #1: This is fixed to show how to do it in WordPress 3.1 and the current version of Disqus 2.61

Update #2: Please see the comment below from Rutgur for the latest fix

The Problem

On my Blog page the comment count works fine, as you can see in this picture:

The 44 text is displaying perfectly on the Blog, category and archive pages. However on the single post page by default instead of the comment count it says View Comments and is cut off, as you can see below.

So to fix this (or at least change it to the way I prefer, as some people may prefer it saying View Comments), inside the wp-content/plugins/disqus-comment-system folder you need to edit the disqus.php file. For those not comfortable doing this, make a backup or you can always re-install a new copy of the plugin if things go wrong. On line 697 you will see this section of code:

function dsq_comments_text($comment_text) {
global $post;

if ( dsq_can_replace() ) {
return 'View Comments';
} else {
return $comment_text;
}
}

It’s the View Comments wording here that is displaying. Luckily we can easily change this to show the correct number of comments:

function dsq_comments_text($comment_text) {
global $post;
$number_of_comments = get_comments_number();
return $number_of_comments;
}

So once done, my single post page now looks correct, displaying the number of comments:

There, looks lovely again. This isn’t really a bug as it’s designed to say View Comments there, however in the default WordPress comment system this would show the number of comments here, so we are simply re-creating that functionality.

Post comment as twitter logo facebook logo
Sort: Newest | Oldest
keerthi 5 pts

Great blog article about this topic, I have been lately in your blog once or twice now. I just wanted to say my thanks for the information provided here.

amway.revenda 5 pts

I loved this system to add comments. is a great option for those who wish to manage commentson websites. My site is http://marketmultinivel.com/amway You can add this system on my site? I await contact.

BlogTechGuy 15 pts moderator

If you go to Plugins > Add new and search for Disqus you can easily install it there.

My latest conversation: Client Spotlight: I Am Not Making This Up

Gowebbaby 5 pts

Yes I am agree with you. I also like disqus plugin for comments. You have provided very good information.

free dating sites 5 pts

There are many commenting system whom will you correct

No, it should take the comment text set in your Disqus dashboard set for 0 comments, 1 comment and multiple comments. I had it set to show nothing in the example as I didn't want any text to show.

There are a couple of updates at the start of the post, but thanks for letting me know the change!
Text can be added yes, there is also an option in the Disqus dashboard for the text too.

Thanks, helped a lot

I'm a programmer student. This helped a lot! Thank's bro

What happens when the site you frequent, disqus comment box stopped appearing.

I have to use web developer, and show hidden elements to see it.

I cant sem to make it appear anymore, and disqus acts like it doesnt happen.

They wont even talk to me about it.

They just didnt care.

I don't have that problem at all, sorry. It works great on other sites for me.

Its a problem from the web developer using antiquated jsquery I believe, just on one site I frequent..

Thanks for letting me know.

After research just a few of the blog posts in your web site now, and I actually like your manner of blogging. I bookmarked it to my bookmark website checklist and will likely be checking back soon. Pls try my site as effectively and let me know what you think.
Your home is valueble for me. Thanks!…
This web site can be a walk-by means of for all the data you needed about this and didn’t know who to ask. Glimpse here, and you’ll positively uncover it.
There may be noticeably a bundle to find out about this. I assume you made certain nice factors in features also.

Office Space Boise 

 http://tokcommercial.com

There are actually plenty of details like that to take into consideration. That is a great level to bring up. I supply the ideas above as common inspiration however clearly there are questions just like the one you carry up where an important factor will likely be working in trustworthy good faith. I don?t know if finest practices have emerged around things like that, but I'm certain that your job is clearly identified as a good game. Both boys and girls really feel the affect of only a moment’s pleasure, for the remainder of their lives.
A formidable share, I just given this onto a colleague who was doing a bit evaluation on this. And he in actual fact purchased me breakfast because I discovered it for him.. smile. So let me reword that: Thnx for the treat! However yeah Thnkx for spending the time to discuss this, I feel strongly about it and love reading extra on this topic. If doable, as you become expertise, would you mind updating your weblog with extra details? It is extremely useful for me. Big thumb up for this blog submit!

Dongles 

 http://www.smartdongle.com/what-dongle

Oh my goodness! an incredible article dude. Thank you Nonetheless I'm experiencing situation with ur rss . Don’t know why Unable to subscribe to it. Is there anyone getting identical rss problem? Anyone who is aware of kindly respond. Thnkx
WONDERFUL Post.thanks for share..extra wait .. …

Wickless Candles

http://www.newflamelesscandles.com

Aw, this was a really nice post. In concept I wish to put in writing like this additionally - taking time and precise effort to make a very good article… but what can I say… I procrastinate alot and certainly not seem to get one thing done.
I’m impressed, I need to say. Actually rarely do I encounter a weblog that’s each educative and entertaining, and let me tell you, you have got hit the nail on the head. Your thought is excellent; the problem is something that not sufficient individuals are speaking intelligently about. I'm very happy that I stumbled throughout this in my seek for something regarding this.

Denver Plumbing Services

 http://www.rnrenterprisesinc.com/industrial-servic....

I’d need to check with you here. Which isn't one thing I usually do! I get pleasure from studying a put up that may make people think. Additionally, thanks for permitting me to comment!

Boise Plumbers 

http://www.rotorooterboise.com/list-plumbing-servi...

Do you have any idea on how to get a recent comments widget to link to the correct comment,
the comment numbers on the anchors are different
Thanks

Sorry I have never used that, so I don't. Have you tried their support ticket system?

Thanks for this great information about disqus and disqus is the best place for blog commenting.

All - I've updated this to show how to do it in WordPress 3.1 and the current version of Disqus 2.61.

 Hello Joel, I would like to thank you for providing this helpful post, it worked for me. The only thing is, what code should I substitute if I want to show the text too? Right now, it only says '1' where I would like it to say '1 Comment' or '2 Comments.' Any ideas?

Hi. I think you can change this in the Disqus settings in your dashboard on the Disqus website. Login there and check your settings.

Hmm, I see where you're coming from, but I didn't change any of the default settings. Using your method, my posts only showed the number, I'm interested in showing both the number and text. I thought it had something to do with the calls you used, but I wasn't sure. Really, I'm just trying to get it to work on my Wordpress theme because originally all it said was View Comments where the indicator (on the homepage) went. 

So you want the word comments after the number? This post has a potential answer in Step Two:

http://www.nathan-miller.com/fix-disqus-for-wordpr...

I have done with sorting.

Oh nice, thanks for your information!

Any updates on this as this post seems currently outdated... line 485 is not the same as it was before :)

What a terrific article

And I'd like to highlight authors comments and add a logo to comment like you do? Could you give a hand there as well?

This is simply some styling, so in your Disqus Account go to Settings > Appearance and at the bottom under Custom CSS I have added:

.dsq-moderator {
background: #E2E2E2 url(LOGO URL HERE) no-repeat top right !important;
}

Which makes the background grey and adds my logo top right.

I also had the same issue and I soted it out with the help of this article. But I have another problem that, I wan the page scroll down to comments when use click in 'View comment' or 'Number of comments' link.

How can I get this done?

You need to link the wording to #comments which is the standard WordPress anchor link for the comments section.

I disabled this by changing:

return '[span class="dsq-postid" rel="'.htmlspecialchars(dsq_identifier_for_post($post)).'"]'.$count.'[/span]';

FOR:

return $count;

AND:

return '[span class="dsq-postid" rel="'.htmlspecialchars(dsq_identifier_for_post($post)).'"]View Comments[/span]';

FOR:

return $comment_text;

- Works like a charm

ps: i changed for [], otherwise the code wouldn't show up right.

Thanks for letting me know, looks like a simple solution.

This is the perfect solution!  It changes "View Comments" into the exact same counter you have on your homepage (In my case, that's "# Comments and # Reactions")  You're a genius sir!
Joel, do you think you could update your blog post to include this alternative solution as well? By highlighting it in your popular blog post (it was the first thing I found when googling) you could really help a ton of people.  Thanks Joel, and thanks for writing this blog post in the first place to help us all!

Great idea, I will update the post with a note now!

Good job. Was looking for a solution. Thanks!

Can you explain me how can i replace the "0" in the counter? I don't get it, i readed your comments, but i don't understand it. I'm from poland and it didn't work on my blog : www.hajducek.pl. Can you explain me it from step to step?

Things have changed in the new version of Disqus I'm afraid, this doesn't work anymore, sorry!

Just noticed mine is broken... is there another way to fix it? :(

Oh, things are much much better fixed now.

I've been using this fix for a while, but with the latest version of the plugin, it shows "0 comments" all the time now instead of the actual count.

They redid some of the coding around those lines in the plugin... but I can't figure out how to fix this. ’.$comment_text.‘ replacing View Comments gives a 0 comment count every time.

I was able to check the feature to put the javascript in my footer, so the real count shows up, but it's confusing visitors when they see "0 comments" then it changes to some number.

So it now does show the comment number when the page has fully loaded? If so with the javascript loading in the footer it will always load last before it takes over the default WordPress comment wording. I do this on my own site but it loads quickly for me so I don't really notice this issue.

When the page is fully loaded, the comment number shows up, but I need to
have the javascript in the footer (because of my theme or whatever the
comment count doesn't load when it's in the header).

There is a brief delay and it's not a huge deal, but before it would show
the comment count before disqus would kick in and insert the number itself.

Have you updated the plugin recently? I don't understand why it's showing
"0 comments" when comment_text is used now. If there was a way to just
disable disqus from replacing the text that would be even better to be
honest. I already use the comments_number function and that's what gets
replaced... I would rather disqus not replace it at all. I'll look into
that I guess...

-Adam

I disabled this by changing:

"return '[span class="dsq-postid" rel="'.htmlspecialchars(dsq_identifier_for_post($post)).'"]'.$count.'[/span]';

FOR:

return $count;

AND:

return '[span class="dsq-postid" rel="'.htmlspecialchars(dsq_identifier_for_post($post)).'"]View Comments[/span]';

FOR:

return $comment_text;

- Works like a charm
ps: i changed for [], otherwise the code wouldn't show up right.