logo
Ask your WordPress questions! Pay money and get answers fast! (more info)

This is an old version of this answer!

Return to the current answer
First you need to download and upload the PHP-FB SDK from https://github.com/facebook/php-sdk

Then you can insert the following code into your functions.php


require_once 'path/to/fb/php/sdk/src/facebook.php';
define("FB_APPID", "****YOUR FB APP ID****");
define("FB_SECRET", "****YOUR FB SECRET****");

global $fb, $signedRequest;
$fb = new Facebook(array(
'appId' => FB_APPID,
'secret' => FB_SECRET
));
$signedRequest = $fb->getSignedRequest();

function fb_user_theme( $template = '' ) {
global $fb;
if (isFacebook()) {
return "***YOUR THEME NAME***";
}
return $template;
}

function isFacebook() {
global $signedRequest;
if ($signedRequest != null) {
return true;
}
return false;
}

add_filter('template', 'fb_user_theme');
add_filter('stylesheet', 'fb_user_theme');


Mind you this will change the theme that is loaded. Also note that I have loaded the FB sdk into the global variable $fb and I have loaded the signed request into $signedRequest so that you can reuse them.

Julian Lannigan | 09/09/11 at 2:28pm

This is an old version of this answer!

Return to the current answer