How can I check if a post has Facebook comments on it and create a conditional statement? I'd like to show a small comments icon if any comments have been made.
Even better, anyone know how to get the comments count from it as well?
There's a tag you can include
If you want to get the actual number without it just being echoed then you'd probably need to do some kind of client side scripting, eg with jQuery:
Above not tested in any way...
Or if you want to do it server side, which is almost certainly a better idea but will be more fiddly, then take a look at: http://developers.facebook.com/docs/reference/fql/comment/
There's a class that makes the count increment per comment. Use that within your loop with an if (!emtpy) conditional and style accordingly. See below:
The fb:comments-count tag will emit the number of comments on your URL in a
You can also load an iframe from Facebook which will display the number of comments with a link to your URL. For example, this shows the number of comments for example.com.
The number of comments left on a particular URL can be accessed via the Graph API. For example, the number of comments on example.com is the 'comments' field of: https://graph.facebook.com/?ids=http://example.com/.
You can also use the comment FQL table.
When you figure out the code post it here for us all! :)