Family Encyclopedia >> Electronics

How to embed SoundCloud in your WordPress posts using oEmbed

One of our users asked us for an easy way to integrate SoundCloud into their WordPress site. WordPress has this cool feature called oEmbed that supports auto-embed as long as you post the URL on its own line. Currently, the WordPress oEmbed library supports popular services like Youtube, Twitter, Vimeo, etc. However, SoundCloud is not supported by WordPress yet. Well, nothing to worry about because WordPress makes it really easy to add providers with oEmbed using the wp_oembed_add_provider() function. In this article, we will show you how to add oEmbed support for SoundCloud in WordPress.

Update:You do NOT have to use this tutorial anymore. WordPress 3.5+ has built-in support for SoundCloud.

All you have to do is paste the following code into your theme's functions.php file or a site-specific plugin.

 // Agregar la función de SoundCloud oEmbed add_oembed_soundcloud () wp_oembed_add_provider ('http://soundcloud.com/*', 'http://soundcloud.com/oembed'); add_action ('init', 'add_oembed_soundcloud'); 

That's it. Just paste your SoundCloud URL on a separate line and let the oEmbed magic do the rest.

There is quite a popular plugin that you can use as well as SoundCloud is Gold which offers many features. Alternatively, since SoundCloud is officially supported by WordPress.com, there is a shortcode available for all WordPress.com users. Therefore, you can use the JetPack plugin for hosted WordPress and enable the shortcode embed option. Once you do, you'll be able to use the shortcode like so:

[soundcloud url ="http://api.soundcloud.com/tracks/207988" iframe ="true" /]

Hopefully this helps anyone looking for a way to integrate SoundCloud into WordPress.