WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to dynamically get the facebook php sdk from my current themes folder.

I am writing this in my functions.php, but all my attempts break the site.

See my attempts below...

require template_url('/') . 'facebook-php-sdk-6c82b3f/src/facebook.php';

require get_bloginfo('template_url') . 'facebook-php-sdk-6c82b3f/src/facebook.php';

Can any one help me understand why this does not work?

Thank you very much.

share|improve this question
have you echoed the result of your statements and seen what you're asking to be required? Might be a good starting point. – anu May 4 '12 at 9:11
I just realized that it works with out the template url part. I thought I might have to require the full path, but it works relative to the where the functions php is. Silly me. – Joshc May 4 '12 at 9:14
up vote 3 down vote accepted

Use get_template_directory() instead , require doesn't work with http://

share|improve this answer
ahhh I see. Thank you – Joshc May 4 '12 at 9:35
you're welcome, but like you said you don't need the full path. – Pierre May 4 '12 at 9:39

I did not actually need to use the full path, it works using a relative path from the functions.php

require 'facebook-php-sdk-6c82b3f/src/facebook.php';

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.