Facebook Wall Feed for WordPress

Image of Facebook Status on Personal Blog
Here is an example of what I was able to come up with to get my wall updates from Facebook on my WordPress blog site.

*UPDATE – JUNE 23, 2011: I finished the blog post for the new version of my Facebook Wall Feed for WordPress code. Please refer to the new code from now on as the code and information here doesn’t work anymore.*

*UPDATE – June 21, 2011: At the beginning of June Facebook changed the way they handle calls to get the wall updates. The code given on this page will no longer work. I have made some updates to my code to get it to work for my site and am working on the write up for instructions on how to get it working the new way*

With all the Facebook plug-ins that were available for WordPress, I assumed that they would have one that would display your feed from your Facebook wall. I was wrong. So I set out to find a solution.

In my searches on Google I found many answers on how to do this for the previous version of Facebook. In the previous version there was a way you could find the RSS link of your wall feed and use that to display it on WordPress or any external website. It appears that the new version of Facebook no longer has this ability. When I tried it, the link would always just redirect me to my profile page. This is not what I was looking for. I wanted to be able to display my status updates on my blog so those that are either not on Facebook or those that aren’t my friends on Facebook could still keep up with my updates.

So I had to break out my programming skills and come up with my own solution. It actually was a little easier than I had first anticipated. The biggest problem was that the feed returned JSON objects. Unfortunately I have not really had much experience with JSON. So this was a learning opportunity for me. Once I was able to parse the JSON objects I could then have the output written as HTML. Now all that was left was to organize it and format it to have the same look as other Facebook elements. This wasn’t that hard, but it is very time-consuming.

So for starters I just concentrating on the status updates. I will have to find time for the Places updates, link posts, photo posts, etc…I figure if I can get around to it I would love to get that done and then make it a WordPress plugin to help others out. I have already started on a php class to handle everything. If there is anyone that is familiar with making a WordPress plugin and would like to help, please contact me. I’m all for sharing the work load.

Facebook comments:

Fedil

I was originally born in Missouri, but traveled around most of my childhood. My mom finally got tired of moving while we were in Dallas, Texas and I have been here ever since. After high school I started college at the University of North Texas (UNT) and started working in the computer field. I currently work for JCPenney as a front end software engineer for their e-commerce website. Before this I worked for AT&T about 12 years and started with them in 1999 (when they were Southwestern Bell). I have many passions and I really love photography. Besides photography I also love sports. I not only like to watch it, but I also love to play. Currently my friends and I play indoor soccer and flag football.

47 thoughts on “Facebook Wall Feed for WordPress

  • February 1, 2011 at 3:04 am
    Permalink

    i’ve been searching for a couple of days for this. would you post how you were able to do it? even getting just the status updates would be great. thanks.

    Reply
    • February 1, 2011 at 9:18 am
      Permalink

      I’ll put up the php class file I have for download and then an example of how to use it. I’ll see if I can’t get to that here in the next few days.

      Reply
      • February 22, 2011 at 8:18 pm
        Permalink

        can’t seem to get your example php to work even with carrotquestionmarkphp in front. it says an error on line 1?

        Reply
        • February 22, 2011 at 9:06 pm
          Permalink

          Sorry just noticed the example didn’t include everything. It should be:

          <link href="uki_facebook_wall_feed.css" rel="stylesheet" type="text/css" />
          <?php
          include("uki_facebook_wall_feed.php");

          $feed = new uki_facebook_wall_feed('#########');
          $feed->get_fb_wall_feed();
          $feed->display_fb_wall_feed();
          ?>

          Replace the ##### with your facebook profile id.

          Reply
  • February 8, 2011 at 11:41 pm
    Permalink

    Would you be able to provide a little more detailed instructions for us noobs?

    Reply
    • February 11, 2011 at 1:18 pm
      Permalink

      I’ll try LOL The problem is since I haven’t made it into a plugin you have to do a lot of stuff manual. Sorry.

      Hopefully you have either ftp or ssh access to the server that is hosting yourwebsite. If you do you will need to upload the class file I provided above to the directory of your theme and rename it uki_facebook_wall_feed.php. Once you do that you would then need to add the example lines of code from above and put it where you want it to be displayed. In my case I put it in the sidebar.php file. I hope this helps a little.

      If someone knows of a quick easy way for me to make this a plug-in or would make it a plug-in I would be greatly appreciated.

      Reply
    • March 2, 2011 at 10:23 am
      Permalink

      Did you verify that your Facebook privacy settings were completely open? Also do you have all three of the following lines with the ###### replaced with your Facebook ID? If you don’t mind, what is your Facebook ID? That way I can check to see if I can pull it.

      $feed = new uki_facebook_wall_feed(‘#########’);
      $feed->get_fb_wall_feed();
      $feed->display_fb_wall_feed();

      Reply
      • March 5, 2011 at 1:22 pm
        Permalink

        I set everything to Everyone, and I’m still getting this problem. 🙁

        Reply
        • March 5, 2011 at 7:19 pm
          Permalink

          What is your facebook id? I’ll see if it works on my test page.

          Reply
        • March 9, 2011 at 2:55 pm
          Permalink

          Not sure if you got my email or not, but when to access your facebook page directly it wouldn’t let me see anything. It only showed the section for your basic info and didn’t show your wall at all. It also gave a message that had the privacy lock on it that read: “Kyle only shares some profile information with everyone. If you know Kyle, add him as a friend.”

          So either it didn’t save your privacy changes or you didn’t open up the correct settings.

          Reply
      • March 12, 2011 at 12:54 pm
        Permalink

        Hi! Thanks for the reply!

        I don’t want the script to display my feed, I want it to display my page’s feed, here is the id of the page: 187909351222336

        Thanks again!

        Reply
        • March 23, 2011 at 1:59 pm
          Permalink

          I haven’t really looked at how the page feed works vs the status feed. I started this with just the intent to grab my status updates so I could include it here in my blog too. If I get some spare time I might be able to look into adding more options, but as of right now I just want to accomplish the status update feed.

          Reply
  • March 5, 2011 at 7:34 pm
    Permalink

    To those that are having problems with nothing showing up. Could you add the following line to in the uki_facebook_wall_feed.php file in the function display_fb_wall_feed():
    echo “

    Count = ” . count($fbFeed) . “

    “;

    So the first few lines of the function should look like this:

    function display_fb_wall_feed()
    {
    $fbFeed = $this->fbWallFeed[“data”];
    echo “<p>Count = ” . count($fbFeed) . “</p>”;

    Reply
    • March 9, 2011 at 2:50 pm
      Permalink

      Also please let me know if you can see my Facebook Status updates on the right hand side of this page.

      Reply
  • March 11, 2011 at 8:07 pm
    Permalink

    So I see your status on the right.

    When I put the code in, it posted what others had posted on my wall and not my statuses. *help!*

    Reply
    • March 12, 2011 at 8:25 am
      Permalink

      Thanks! I just wanted to make sure my code was actually working. If it’s not showing anything there are only 2 reasons I can think of. 1st is that your privacy settings aren’t completely open to allow everyone to see your wall updates. 2nd is that you might need to create a facebook app. I have done this for some other things, but maybe it is needed for this and I just didn’t notice since I already had it setup. You should be able to follow the following directions and just put in your blog url instead of example one listed:
      http://ottopress.com/2010/how-to-setup-your-facebook-connect-application/

      Reply
  • March 12, 2011 at 2:27 pm
    Permalink

    Yeah i’ve done it for other things too. I’ll try later and update.

    Do you know if there’s a way to edit the code to only show my status updates. I thought yours was doing that but then I scrolled and saw it was showing other feeds too. I had set everything to public when I was testing.

    Reply
    • March 13, 2011 at 11:59 am
      Permalink

      Cool. Yea let me know if you get it to work.

      Actually it is set to only display status updates. Unfortunately if someone writes on your wall it is considered a status update. That is why you see those. It doesn’t show my links, videos, or places check-ins. So basically status updates count as anything written on your wall. Maybe there is a privacy setting that you can limit who can see other people’s posts on your wall?

      Reply
  • March 16, 2011 at 10:10 am
    Permalink

    Hey,
    Thanks for the code…I have spent hours trying to find some way to do this (impossible with how often they change Facebook!). I am having some trouble with implementing the code. Basically, I did all of the changes you mention but it comes up with the white box and then “Count = 0”. Any suggestions? The site I am trying to get this into is a test site at http://www.oliviermg.com/mwm/.

    If we can get this working, I might be able to help packaging it into a Plug-In. If I can, I would be more than happy to.

    Thanks!

    Reply
    • March 19, 2011 at 7:50 am
      Permalink

      Hey Michael,
      I went to your site and I see a few posts. Did you get it working? Or did you find something else? The only guess I can come up with for the people who are getting the blank white box and 0 count is that either the permissions aren’t completely open or you have to register your website as a facebook app (http://ottopress.com/2010/how-to-setup-your-facebook-connect-application/). That link should give a general idea how to do it if you don’t know how. Let me know if you have done that step. I’m curious if that fixes this particular problem.

      Reply
  • March 18, 2011 at 8:34 pm
    Permalink

    Hi Fedil,

    First thanks for taking this task on. Been looking for a solution to this for a while.

    When I paste on of your lines of code into a browser:

    https://graph.facebook.com/%5BID%5D/feed?limit=100

    and put the correct [ID] in place I get a page displaying the feed. However, the same id produces comments, etc. from people who have liked articles, but have NOT commented on the wall for that ID. The behavior is a bit bizzarre. Wonder if you have seen this.
    Let me know if you have any questions.
    Thanks,
    Bert

    Reply
    • March 19, 2011 at 7:43 am
      Permalink

      Bert,
      Thanks! I’m not sure I have seen that. I know if you put that url into a browser it spits back everything from your profile wall. So it includes comments, likes, links, photos, and status updates. The code I wrote only looks for the ones marked as status updates since that is the only one I got around to parsing in my php code. I eventually want to be able to parse everything and even include the comment and like counts.

      Reply
    • March 23, 2011 at 8:14 am
      Permalink

      Nikos,
      Thanks for the feedback. It is nice to know you got it working. I had not even thought of that. I wonder why mine works with the https. I guess it doesn’t matter though. Hopefully others that are having issues will see this and try it. Hopefully it works for them as well.

      Reply
  • April 11, 2011 at 10:52 am
    Permalink

    Working great for me – time to tweak some of that CSS to make it really tasty. Thanks for code – this was an epic Facebook fail in my opinion.

    Reply
    • April 11, 2011 at 9:52 pm
      Permalink

      Yea I don’t know why they keep messing with things. Hopefully since this uses their OpenGraph protocols it will last.

      Reply
  • April 11, 2011 at 11:58 am
    Permalink

    It appears that attempting to use this alternative with HootSuite has some issues – especially when shrinking a URL and posting a status update.

    Otherwise, it’s working great for me.

    I was able to remove the Facebook profile pic (some of my followers have questionable pics and since this is a business site, best to keep that bit out) and create a string of posts.

    Thanks again!

    Reply
    • April 11, 2011 at 9:53 pm
      Permalink

      You’re welcome! I’m glad it works. Yea feel free to hack the crap out of the code to get it to work for your needs. I’m hoping to add to this and get it to display links, places, etc when I get some extra time.

      Reply
  • May 31, 2011 at 8:26 am
    Permalink

    Thanks Fedil an excellent solution.

    I copied your code and it worked first time.

    The format is however not very like facebook’s (e.g. photo’s are not floated left of the rest of the comments, etc..

    Yet the format of your own ‘Facebook Status’ (top right of your page) is very like facebooks.

    Are you happy to provide the css you are using?

    EIther way – thanks

    Reply
  • May 31, 2011 at 6:10 pm
    Permalink

    Correction – css link wasn’t working!!
    It is now … and formatting is just like Facebook

    I also want to display the Facebook ‘events’ – do you know how to do this? – thanks

    Reply
    • June 4, 2011 at 1:04 pm
      Permalink

      Glad you got it working! 🙂 Actually I just moved and am still settling in. Once I get that done I want to do a few more things with this. So I’ll keep you updated.

      Reply
  • June 4, 2011 at 1:09 pm
    Permalink

    Ok…just checked out the code again today and it now appears you have to create an access token in order to get this information. So I’ll post an update to the code once I figure that part out and add it in. If anyone else already knows how to do this, please share the info.

    Reply
    • June 7, 2011 at 2:36 am
      Permalink

      Thanks. Yea I have seen those. I do already have an app id. Where I’m getting stuck at is the access token. I did go to that page earlier this weekend and used the code for the app access token since I want anyone to see it whether they are on facebook or not. To my surprise it doesn’t show all my posts. It only shows my posts I do via twitter. The ones I post from the site or my Iphone facebook app aren’t showing up. When I use the server method they show it does allow me to see everything, but in order for me to get the access token via that method it requires redirects. As this is only a sidebar item it sucks to have to redirect every page and also won’t allow those that don’t have facebook to see anything. So either facebook has a bug or there is a way around only see certain status updates. Still looking into it.

      Reply
  • June 7, 2011 at 2:42 pm
    Permalink

    Ok, I finally figured out the issue. Along with adding the requirement of an access token they also made it to where the app has to ask for specific permissions. After I added everything it now works like it is suppose to. I’ll try to get the updated code on the site for people to download by this weekend. I’ll probably create a new post about this new change.

    Reply
    • June 8, 2011 at 7:47 pm
      Permalink

      Thanks for the link, but it is step 2 of it that was giving me trouble. Because the documentation doesn’t specify what authentication you need to ask for in order to see all the posts in the feed. So without that step it still doesn’t work right.

      Reply
  • June 15, 2011 at 5:58 am
    Permalink

    Hi Fedil,

    I use your code to my site and it is work fine untile some day ago. Now, my wall feed not visible to my site but i look your wall feed in this site still visible. What’s wrong with your code?

    Reply
    • June 15, 2011 at 11:36 am
      Permalink

      Hey,
      Facebook changed their calls to the status updates and now require an authentication token. I’ve updated my code, but haven’t had time to do a write up on it. I’ll do that later today or tonight and post the new code. I’ll reply back here once I have the write up done and link back to it.

      Thanks,
      Fedil

      Reply
    • June 16, 2011 at 9:42 am
      Permalink

      I started the new post last night but wasn’t able to finish it. I should have it done and the new code avail tonight.

      Reply
  • June 20, 2011 at 3:46 am
    Permalink

    Hi Fedil,
    Just wondering if you have the updated code ready yet? I have been trying to get this working on my site but not having much luck.
    Regards,
    Ryan

    Reply
    • June 21, 2011 at 10:05 am
      Permalink

      Sorry for the long delays. Things have been very busy for me so I haven’t had as much time as I had hoped. I’m in the process of finishing the write up cause there are more details involved now that Facebook changed the way they do things. I do have the code working though as you can see my status updates on the right. So I know the new code works. I’ll do my best to get it up by tonight. The write up has pretty much a step by step to get it working.

      Fedil

      Reply
  • February 22, 2012 at 7:59 am
    Permalink

    Hi,

    I’m using your wordpress plugin and It works.
    Now I need to transform facebook post I see in my wordpress page in RSS2 feed..

    I need a feed url that shows my facebook wall’s posts..

    Is it possible?

    Thanks

    Reply
    • February 22, 2012 at 5:44 pm
      Permalink

      I’m sure it is possible. I haven’t really looked into it though. I’m sure you can take the feed that you are getting from the plug-in and then just write something to convert it to the RSS format.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *