Facebook page widget
-
Hello guys,
I am considering adding to a web site the ‘feeds’ that get written on facebook page.So for example, let’s say I am interested in the facebook page ‘WordPressPage’ http://www.facebook.com/WordPressPage.
Is there a way I could, on my website, display everything that get displayed on this facebook page wall? I must be able to add it to a custom template.
Thanks in advance !!
Nancy
-
Do you want widget on sidebar or full page?
I want it inside a page (i.e. inside specific custom template page), not on sidebar.
This is how I would do it.
1. I would install plugin called Exec-PHP.
2. Use facebook graph api to get feed from page: (first you have to get accesss token). than you have to write PHP script to parse JSON from url
http://graph.facebook.com/pageID/feed
I think page name is OK too.
3. Paste script to Exec PHP.Maybe there is some easier way but than I am not aware of it 🙂
Basically srcipt is very simple and it is something like this:
$page = "your page ID or username"; $url = "https://graph.facebook.com/". $pageID ."/feed"; $json = file_get_contents($url); //get json content $feedarray = json_decode($json); //decode json foreach($feedarray->data as $post) { //loop through array $message = $post->message; echo $message; }You can make it more complicated by adding links, but it is not much of a programming. Just take a look at JSON structure at http://developers.facebook.com/
http://ww.wp.xz.cn/extend/plugins/embed-facebook/
Also there is this plugin, but i have never tried it.
The topic ‘Facebook page widget’ is closed to new replies.