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.

  • have you echoed the result of your statements and seen what you're asking to be required? Might be a good starting point.
    – anu
    Commented May 4, 2012 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
    Commented May 4, 2012 at 9:14

2 Answers 2


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

  • you're welcome, but like you said you don't need the full path.
    – Pierre
    Commented May 4, 2012 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';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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