Displaying your blog inside Facebook in 6 simple steps
5 – Make the custom tab default fan page landing box
Go back to your fan page manager and choose to “View page”.
Now click on the “+” plus sign at the right of your default page tabs, right after “wall”, “info”, “photos”, “discussions”. The name of your brand new app should appear in the drop-down list. Choose that. This will add the tab to your page.
Now don’t worry if the page actually displays errors or strange parts of your blog. We still need to configure WordPress to display the right content in there. But that should prove Facebook already established a connection with your blog! Don’t worry either if the page stays blank. We’re not there yet.
Click on the “Wall” tab, and then click on the “settings” button in the upper-right corner of the wall content section.
This will open an options box, where you can change the “Default Landing Tab for Everyone Else”. In the drop-down list, choose your custom tab name.
Okay! The Facebook configuration is over, let’s continue to configuring WordPress!
6 – Configure WordPress to serve a custom stripped-down page for displaying inside Facebook
Now, for real WordPress folks, this is the easy part.
What we want basically is to setup a custom page template tailored to display a basic version of our blog’s post list. And then just create a page with the appropriate URL that Facebook will query and display inside the above-created fan page.
So first, let’s create a strippped-down page template. You can do that by copying the existing page.php template in your /wp-content/themes/<active-theme-name> directory. Make a copy and rename it “facebook.php”.
Now edit that template with your favorite text or php/xml editor. Here’s what you need to add at the very top of the template file:
<?php /* Template Name: Facebook */ global $more; $more = 0; query_posts( 'showposts=10' ); ?>
And in the page’s code, get rid of all the calls to display page headers, side bars and footer. So let’s erase those lines:
<?php get_header(); ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
Also get rid of all code referring to external Javascript calls (such as advertising display), and to objects. Facebook won’t allow things such as “<noscript>” tags and a few more. You’ll see what else needs to be gotten rid of later on by trial and error. Facebook will display error messages when something is wrong.
Save the customized facebook.php template file and put it in your above-mentioned active theme template directory.
Now go to the WordPress admin, and create the page hierarchy.Create a new page with the first-level slug we chose up there during step 2.
In our example the page title (and thus its slug) should be:
Before publishing this page in WordPress, be sure to setup the page template to the newly created “facebook” page template. Leave the page content blank.
Now create the second page level. In our example the page title (and thus its slug) should be:
home
Again, leave the page content empty but make sure to choose the “facebook” page template. Make that page a “child page” of the above-created first-level page by setting it’s “parent” page to “facebook”.
That’s it. You’re all set.
Go back to Facebook and refresh the fan page custom page screen by pressing ctrl+F5.
You should now see a stripped-down version of your blog’s front page appear inside Facebook.
Now you can go back to your WordPress template to customize the look and feel of that page so that it fits Facebook’s design as well as possible. And get rid of “illegal xml” errors if Facebook displays any.
Enjoy!
Want to see an actual example? Here it is!
PS: If you wonder if steps 1 to 5 allow you to display just any web page content inside Facebook, the answer is…yes! You can display just about anything in there as long as it satisfies Facebook’s strict XML content parsing rules (no Javascript, no objects, etc.) – So in effect, this tutorial is not limited to WordPress at all.



le 21 December 2009 à 21:50 h
does this method only work for sites that can create pretty permalinks? i wanted to implement this on a blogger site.
le 22 December 2009 à 12:08 h
This method will work with any kind of page or url, even html static pages.
le 23 April 2010 à 16:48 h
Hello. I have followed your instructions and successfully created an app that pulls from my wordpress blog! Yea!
One problem. The pictures embedded in a post don’t show up? Well, that’s not exact true. INITIALLY they showed up, and now they aren’t showing up, but I’ve not changed a thing on my blog so trying to figure out what the problem is there? Any ideas? To see what I am talking about, go to http://www.facebook.com/pages/Savvy-Design-Divas/340132140442?v=app_375548276146&ref=ts
Thanks!
le 23 April 2010 à 16:51 h
@Jeanne:
I can very well see 2 embedded images in the Facebook note you linked.
So it looks like at least some of your images show up.
le 23 April 2010 à 17:03 h
Silly me, the pics show up fine. Google Chrome wasn’t happy about something, but all is well. Thanks again – great article!!
le 6 May 2010 à 16:16 h
Everything works except for the display of the website inside the tab, I’m receive errors like so, + FBML Error (line 17): illegal tag “body” under “fb:tab-position” +
which makes it seem I need to recode to FBML.
Thanks for your tutorial and help
le 9 July 2010 à 23:04 h
After adding the application to my Page, it does not appear in the list of tabs to add when you press the “+”… why ?
le 17 July 2010 à 2:41 h
hi,
after attempting to use your solution. I ended up deciding not to try this solution. I have since encountered a serious problem. I did actually copy my page php and renamed it facebook.php. I temporarily named a page on my wordpress blog “facebook,” that page is now deleted. For some reason, I can no longer access any part of my website on the internet. From any computer. I keep getting a 404 error.
For example, when I type in my site address, “http://cellphone-spyware.com” I get directed to “http://cellphone-spyware.com/facebook” This does not exist as a page. I get the 404 error. I can’t fix this. Help me please.
le 31 August 2010 à 21:24 h
First, I must say thank you again for such wonderful instructions. I have used this method on 4 different facebook pages. I have a new question though – I would like to have a post on my site that contains a contact form (contact form 7 is what I use) that is also displayed on a tab on my facebook page (using the above method). When I tested this, the contact form doesn’t quite work “within” the facebook tab…..It’s displayed fine, and I can populate the fields, hit send, but instead of the usual validation message returned, the page actuall re-routes to the Facebook canvas page for the application itself (which, is, interestingly, an iframe of my website, although it’s ‘page not found’ error). Any ideas?
le 23 September 2010 à 20:34 h
so i created the app and it works. but i am having the hardest time to add it to the fan page. when I click the + sign it does not show…
le 6 October 2010 à 22:23 h
[...] La suite de cet article (créer une page de fan dans Facebook) est pour l’instant disponible e… [...]
le 3 June 2011 à 10:21 h
You sould post some damn photos with this tutorial.
le 3 June 2011 à 13:00 h
@JonnyQ: send the photos over and I’ll be happy to post them.