web - Getting DISQUS comment count -
i'm trying comment count comic on comics website. example, comic id 66 has 2 comments. i'd count , display on page. far when follow disqus guide below, gives me link comic comments, doesn't give me total comments.
append
#disqus_thread
href
attribute in links. tell disqus links , return comment count. example:<a href="http://foo.com/bar.html#disqus_thread">link</a>
.
but how count if url string this:
<a href=".?action=viewimage&site=comics&id=66">link</a>
so questions are:
where append
#disqus_thread
?how can comments count 1 comic url , display total comments on page?
while old thread looks no answer accepted add thought incase helps others.
in function.php add following:
function disqus_count($disqus_shortname) { wp_enqueue_script('disqus_count','http://'.$disqus_shortname.'.disqus.com/count.js'); echo '<a href="'. get_permalink() .'#disqus_thread"></a>'; }
then on page want comment counts appear add following:
<?php disqus_count('myshortcode'); ?>
be sure add in "the loop" , replace myexampleblog disqus account short name. in disqus account can see wording use such "0 comments", "1 comment", "3 comments" etc.
Comments
Post a Comment