I know two ways to retrieve the number of comments on Facebook:
<fb:comments-count href=http://example.com/></fb:comments-count> awesome comments
and...
<iframe src="http://www.facebook.com/plugins/comments.php?href=example.com&permalink=1" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:130px; height:16px;" allowTransparency="true"></iframe>
But none is a semantics for HTML5 solution, is there any alternative?
You can also get HTML5 valid FB comment count this way:
<div class="fb-comments-count" data-href="/post URL">0</div>
FB automatically replaces the "0" with the correct number. If you put something there like "awesome comments", it will be replaced with the number of comments i.e. "13", etc.
In order to get the number and use your own text, do something like this:
<a href="/post URL"><div class="fb-comments-count" data-href="/post URL">0</div> awesome comments</a>
Notice you must wrap your class in div's or else the comment counter will not work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With