Facebook page widget (5 posts)

  1. enigmasolution
    Posted 4 years ago #

    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 !!

  2. Vuk Stanković
    Posted 4 years ago #

    Do you want widget on sidebar or full page?

  3. enigmasolution
    Posted 4 years ago #

    I want it inside a page (i.e. inside specific custom template page), not on sidebar.

  4. Vuk Stanković
    Posted 4 years ago #

    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
    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/

  5. Vuk Stanković
    Posted 4 years ago #

    Also there is this plugin, but i have never tried it.

Topic Closed

This topic has been closed to new replies.

About this Topic