Support » Plugin: disqus » [Plugin: disqus] Comment count always shows 0

  • Since upgrading Disqus to the latest version, comments counts (at the top of the post page and on the front page listing multiple posts) all show 0.

    I had to re-apply a change I made to the original installation, changing:
    return '<span class="dsq-postid" rel="'.htmlspecialchars(dsq_identifier_for_post($post)).'">View Comments</span>'; to
    return '<span class="dsq-postid" rel="'.htmlspecialchars(dsq_identifier_for_post($post)).'">'.$comment_text.'</span>';

    in disqus.php. This worked before and doesn’t appear to have changed in this update but now it’s not working.

    Any ideas?

    Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Chuks

    (@cybernergies)

    Hi,
    I had a similar problem, and just fixed it by using the code below:

    function dsq_comments_text($comment_text) {
    global $post;

    if ( dsq_can_replace() ) {
    return ‘<span class=”dsq-postid” rel=”‘.htmlspecialchars(dsq_identifier_for_post($post)).'”>’ . $post->comment_count . ‘</span>’;
    } else {
    return $comment_text;
    }
    }

    This works ok, i.e. displays the number of counts. However, I am getting 0 comments, event though I have several comments. I haven’t found a fix to this yet. But it seems it will at least get you through your problem.

    Chucks’ approach works, but it has the disadvantage that the comments count format is then hardcoded ie. before you could use

    comments_number('No Comments','1 Comment', '% Comments')

    Now it is simply “0”,”1″,”2″, whatever arguments you give.

    Hello Chucks

    Hi,
    I had a similar problem, and just fixed it by using the code below:

    mind if I ask where exactly did you use this code?
    I’m just not clear.
    did you use it in “disqus.php”

    This works ok, i.e. displays the number of counts. However, I am getting 0 comments, event though I have several comments. I haven’t found a fix to this yet. But it seems it will at least get you through your problem.

    I’m also having the same “0 comments” issue and was wondering if you were able to find a solution.

    I’m also having this problem

    I’m using the Magzimus theme so, like ChimpanzeeUK, every time the plugin is updated I edit disqus.php according to the instructions here: http://blogtechguy.com/1560/fixing-view-comments-in-disqus-plugin/. Otherwise the “View Comments” link is too large for the theme.

    Any help would be appreciated.

    I had the same problem. There seems to be some conflict with disqus andthe function that retrieves the number of comments.

    However, you can access the global $post variable. When I checked the value, it showed the correct comment count. So, try using that comment count and bypassing any fetcher functions.

    <?php echo $post->comment_count?>
    <?php echo ($post->comment_count==1?' comment':' comments');?>

    Hope this helps.

    Thanks joshuahong100! I got it to work like this:

    in disqus.php change the following:

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

    to:

    return '<span class="dsq-postid" rel="'.htmlspecialchars(dsq_identifier_for_post($post)).'">'.$post->comment_count.'</span>';

    I have used this

    function dsq_comments_text($comment_text) {
    global $post;
    
    if ( dsq_can_replace() ) {
    return '<span class="dsq-postid" rel="'.htmlspecialchars(dsq_identifier_for_post($post)).'">' . $post->comment_count . '</span>';
    } else {
    return $comment_text;
    }
    }

    but it doesn’t work on my site Harv Eker. I want that the comments counts update themselves responding to the current number of comments.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: disqus] Comment count always shows 0’ is closed to new replies.