[Plugin: DISQUS Comment System] Disqus comment count at 0
-
I recently began using DISQUS and found that like many other users there were a lot of inherent issues with it playing well with WP.
Some of the issues were based off of DISQUS’s need to insert ‘view comments’ where the comment count would normally have been in my theme. Other issues were related to the comments not showing up at all.
I found, after a LOT of research, that most of the ‘fixes’ listed around the net aren’t updated to the most recent versions of WP. And after a lot of frustration I found that someone had managed to hack together [or at least hack out some of DISQUS’s idiocy] and get it all to play nice.
In the interests of making your life easier and [for when it updates and I have to redo the hacks] all that, I’m posting the link I found and the coding changes you will need to make to fix it. These fixes are different from the DISQUS RSS breakage thread [closed] that is already on the forum.
Solution found by: EVAN WONDRASEK
Step 1: Edit the file /wp-content/plugins/disqus-comment-system/disqus.php
Step 2: Locate the following code at line 692:
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; } }
Replace it with:
function dsq_comments_number($count) { global $post; return $count; }
***[sic]There was no step 3 listed.***
Step 4 (optional – this will fix comment counts in the front-end of your blog if using the comments_number() function in your theme): Locate the following code at line 697:function dsq_comments_text($comment_text) { global $post; if ( dsq_can_replace() ) { return '<span class="dsq-postid" rel="'.htmlspecialchars(dsq_identifier_for_post($post)).'">View Comments</span>'; } else { return $comment_text; } }
Replace it with:
function dsq_comments_text($comment_text) { global $post; $number_of_comments = get_comments_number(); return $number_of_comments; }
I hope this helps you avoid the hair tearing I had to go through. So far I’ve had no bad results from doing this hack.
- The topic ‘[Plugin: DISQUS Comment System] Disqus comment count at 0’ is closed to new replies.