1

I'm fleshing out post formats in a child theme. For link-type posts, if a featured image hasn't been set, I'd like to fetch the OpenGraph image associated with the link and display it.

I've found scottmac's opengraph PHP library, which I assume would allow me to get that OpenGraph data. But how would I go about incorporating that into my child theme and using it? I assume it's not as simple as placing opengraph.php in my child theme's directory, since that doesn't really make sense, but I don't know what actually does make sense.

Thanks!

1

It's not so much harder then you thought.

  1. Copy the library somewhere into your child directory
  2. Include the file with include or include_once PHP function in the child's functions.php file (use get_stylesheet_directory function for getting path of the child theme)
  3. Use the library how you want

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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