Load facebook php sdk problem

You shouldn’t add functionality to themes. Or even worse: To templates. Wrap it up in a plugin and load the plugins bootstrap on plugins_loaded, or – in case of a mu-plugin – on muplugins_loaded.

In every case, you shouldn’t throw around with globals. Just add your output to a custom filter or hook and only add this one to your template: (Example) do_action( 'facebook_app_data' );