Well, I just have a pretty straight question: How do I display recent comments from Facebook Comments social plugin on my website?
I have integrated the facebook com
The social plugin has some ways to change its layout, but all of them will allow the user to write a new comment. One way to get only the comments is by FQL.
To use it, include the facebook all.js on your code (I guess you have it, once you're using the social plugin) and do the following:
First create a div with class 'comments':
<div class="comments"></div>
Then, do the following in javascript
FB.api(
{
method: 'fql.query',
query: 'select text from comment where object_id in (select comments_fbid from link_stat where url ="http://developers.facebook.com/docs/reference/fql/comment/")'
},
function(response) {
$.each(response, function(i, e) {
$(".comments").append("<div class='comment'>"+e.text+"</div>");
});
}
);
If your div has a class that is not comments, just replace $(".comments")
with $(".your-class")
. This code will create several elements with class comment inside your comments element.
I'm using jQuery to iterate the comments.
Hope it helps!
You can use this widget to show recent Facebook Comments made all over your website in the widget area of your choice. https://www.heateor.com/facebook-comments-moderation