How to embed a Facebook page's feed into my website
Ahhh, that's super simple, no programming required.
See: https://developers.facebook.com/docs/plugins/page-plugin
You'll want to keep the show stream
option turned on. You can adjust width and heigth and a few other things.
If you are looking for a custom code instead of plugin, then this might help you. Facebook graph has under gone some changes since it has evolved. These steps are for the latest Graph API which I tried recently and worked well.
There are three main steps involved - 1. Make sure you can code with a server side language (PHP), 2. Getting Facebook Access Token, 3. Calling the Graph API passing the access token.
1. Getting the access token - Here is the step by step process to get the access token for your Facebook page. - Embed Facebook page feed on my website. As per this you need to create an app in Facebook developers page which would give you an App Id and an App Secret. Use these two and get the Access Token.
2. Calling the Graph API - This would be pretty simple once you get the access token. You just need to form a URL to Graph API with all the fields/properties you want to retrieve and make a GET request to this URL. Here is one example on how to do it in asp.net MVC. Embedding facebook feeds using asp.net mvc. This should be pretty similar in any other technology as it would be just a HTTP GET request.
Sample FQL Query: https://graph.facebook.com/FBPageName/posts?fields=full_picture,picture,link,message,created_time&limit=5&access_token=YOUR_ACCESS_TOKEN_HERE
In new page-plugin you can do multiple tabs in your website. The Page plugin lets you easily embed and promote any Facebook Page on your website. Just like on Facebook, your visitors can like and share the Page without leaving your site.
- Include the JavaScript SDK on your page once, ideally right after the opening
<body>
tag.
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5&appId={APP_ID}";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
- Place the code for your plugin wherever you want the plugin to appear on your page.
<div class="fb-page"
data-href="https://www.facebook.com/YourPageName"
data-tabs="timeline"
data-small-header="false"
data-adapt-container-width="true"
data-hide-cover="false"
data-show-facepile="true">
<div class="fb-xfbml-parse-ignore">
<blockquote cite="https://www.facebook.com/facebook">
<a href="https://www.facebook.com/facebook">Facebook</a>
</blockquote>
</div>
</div>
You can also change the following settings:
Also You can now have timeline, events and messages tabs with the new page plugin:
- Timeline Tab: Will show the most recent posts of your Facebook Page timeline.
- Events Tab: People can follow your page events and subscribe to events from the plugin.
- Messages Tab: People can message your page directly from your website. People need to be logged in to use this feature.
<div class="fb-page"
data-tabs="timeline,events,messages"
data-href="https://www.facebook.com/YourPageName"
data-width="380"
data-hide-cover="false">
</div>
The Like Box/ Page plugin is basically an iframe and ugly :D
So I created my own free plugin that I call Famax plugin to display FanPage feeds. It's similar to the like box but has a better UI and is more customizable.
Also because the Like box is shown in an iframe with a fixed width and height etc, its not really responsive.