Knowledge Base/Tips & Tricks

Using oEmbed for Embeds (with Wordpress Example)

administrator
posted this on Feb 08 02:29 pm

LoopLogic supports the oEmbed standard which is a format for allowing an embedded representation of a URL on third party sites. The simple API allows a website to display embedded content (such as photos or videos) when a user posts a link to that resource, without having to parse the resource directly.

To enable oEmbeds on your site, you will need to have add a few lines of code. Here is an example that we use on our own Wordpress blog (Wordpress makes it easy to enable oEmbed):

wp_oembed_add_provider( "#http://(.+)?nextslide\.com/.*#i", "http://api.nextslide.com/oembed", true);
wp_oembed_add_provider( "#http://(.+)?looplogic\.com/.*#i", "http://api.looplogic.com/oembed", true);

This code basically matches a string of text using regular expressions and tells Wordpress to query our api to get the right embed code.

Cool!

Here is a video re: how to use oEmbeds.