Fix WordPress comment count error caused by Disqus plugin

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...
May 28, 2011

Disqus for WordPress is a great plugin for those who want to integrate a better way of adding comments to their blogs. With Disqus, you can allow your visitors to easily post comments through their Facebook or Twitter accounts. Disqus perfectly syncs with WordPress comment system and the comment on your database is also synced with Disqus’ server. But with the latest version of WordPress i.e. WordPress 3.1, Disqus has some issues showing the comment counts for the post. Here is how you can fix comment count error in WordPress 3.1 when Disqus plugin is used.

After upgrading to WordPress 3.1, you would encounter a strange error in the post list area instead of the comment count. This would happen only if you have Disqus plugin for WordPress installed. The error looks something like this:

Warning: number_format() expects parameter 1 to be double, string given in /wp-includes/functions.php on line 155

Disqus comment system

This error occurs because Disqus’ comment count system uses its own value for counting comments that breaks WordPress’s default function number_format_il8n(). This function expects the comment number value to be a double instead of a string. So, we’ll have to edit a file on Disqus plugin folder.

Open the file /wp-content/plugins/disqus-comment-system/disqus.php. Now find the following line of code on your text editor.

[code]function dsq_comments_number($count)[/code]

Your code will look something like this:

[code]
function dsq_comments_number($count) {
global $post;

if ( dsq_can_replace() ) {
return ‘<span class="dsq-postid" rel="’.htmlspecialchars(dsq_identifier_for_post($post)).’">’.$count.'</span>’;
} else {
return $count;
}
}
[/code]

Simply replace the above code with the following.

[code]
function dsq_comments_number($count) {
global $post;

return $count;
}
[/code]

This will do the trick to fix error in comment count on WordPress 3.1 due to Disqus plugin.

You may also like...

  • Chris Richard

    Hello Everyone,

    Are you financially squeezed? Do you seek Loans to pay off credits and
    debts? Do you seek finance to set up your own Business? Are you in need of
    private or Business Loan for various purposes? Do you seek loans to carry
    out Large Projects? Secure a Loan from us today and start up with something
    rewarding. Our transaction is 100% guaranteed as we also ensure a cordial
    relationship with our clients. We offer Loans with no credit Checks, No
    collateral, Easy steps, fast funding and low interest rate of 2%. Why
    remain in a financial breakdown?
    Contact us today via Email: rolandfredrickloaninsuranceplc@gmail.com

  • tina toth

    we offer 5000 to 250,000 Dollars to pay their bills
    as well as solve their other Financial needs?
    Get a loan from our firm only to the 2% interest rate,
    kindly contact us today for your loan.
    expansioncapital112@gmail.com

  • Jane Robin

    THE BEST PLACE TO SOLVE YOUR FINANCIAL PROBLEMS ( upstartloan@yahoo.com )

    Hello everyone in this forum, I am Jane Robin from palm Harbor Florida 34682. USA and want to use this medium to express gratitude to UP START LOAN for fulfilling their promise by granting me a loan, i was stuck in a financial situation and needed to refinance and pay my bills as well as start up a Business. I tried seeking for loans from various loan firms both private and corporate organisations but never with success, and most banks declined my credit request. But as God would have it, i was introduced by a friend named Mary Williams to UP START LOAN whom also confirmed to me that she also obtained a loan from them. In an attempt to resolve my current situation, i got in contact with the company via email and undergone the due process of obtaining a loan from the company, to my greatest surprise within 48hrs just like my friend Mary, i was also granted a loan of $80,000.00; So my advise to everyone who or know someone who desires a loan, if you must contact any firm with reference to securing a loan online with low interest rate of 2% and better repayment plans/schedule, please contact UP START LOAN. Besides, he doesn’t know that am doing this but due to the joy in me, i’m so happy and wish to let people know more about this great company whom truly give out loans, it is my prayer that GOD should bless them more as they put smiles on peoples faces. You can contact them via email on ( upstartloan@yahoo.com ) or Text/Call +1(574) 301-1639