Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am trying to embed a Ted talk video using the shortcode:

[ted id=myid]

But it's not working. It shows the text instead of the video. Is there any configuration I need to check to make it work?

share|improve this question
3  
What plugin do you use for that? – toscho Oct 10 '12 at 13:31
I followed the steps written here: en.support.wordpress.com/videos/ted-talks so i didn't install any plugin – flero Oct 10 '12 at 15:11

1 Answer

up vote 1 down vote accepted

Unfortunately, this is going to be a problem for you.

The [ted] shortcode is specific to WordPress.com - not to a self-hosted site where you installed the software yourself from WordPress.org.

The only embeds that WordPress.org's software supports by default are listed in the Codex:

  • YouTube (only public videos and playlists - "unlisted" and "private" videos will not embed)
  • Vimeo
  • DailyMotion
  • blip.tv
  • Flickr (both videos and images)
  • Viddler
  • Hulu
  • Qik
  • Revision3
  • Scribd
  • Photobucket
  • PollDaddy
  • WordPress.tv (only VideoPress-type videos for the time being)
  • SmugMug (WordPress 3.0+)
  • FunnyOrDie.com (WordPress 3.0+)
  • Twitter (WordPress 3.4+)

There is a plugin available for embedding Ted talks, though. TEDTalks Embedder. But it only lists compatibility through WP 3.2.1, so it may not work with the current version (it may, but I can't guarantee it).


Alternative Actual Embeds

Here's an alternative if you don't want to use a plugin. Add the following to your theme's functions.php file:

// Whitelist the TEDTalks oEmbed URL
wp_oembed_add_provider( 'http://www.ted.com/talks/*', 'http://www.ted.com/talks/oembed.json' );

function ted_shortcode( $atts ) {
    // We need to use the WP_Embed class instance
    global $wp_embed;

    // The "id" parameter is required
    if ( empty($atts['id']) )
        return '';

    // Construct the TEDTalk URL
    $url = 'http://www.ted.com/talks/view/lang/eng/id/' . $atts['id'];

    // Run the URL through the  handler.
    // This handler handles calling the oEmbed class
    // and more importantly will also do the caching!
    return $wp_embed->shortcode( $atts, $url );
}
add_shortcode( 'ted', 'ted_shortcode' );

Now, you can embed TEDTalks two ways:

Enjoy!

share|improve this answer
Oh,ok! And yes TEDTalks Embedder does not work on my testing site ( WP 3.4 ) but it could work on the site i need it because it uses a lower version of WP. – flero Oct 10 '12 at 15:32
If it doesn't, I've edited my answer to provide you a way to add the shortcode handler yourself by dropping some code in your theme's functions.php file ... oh, and I tested it to work on the latest version of WP. – EAMann Oct 10 '12 at 16:12
Thanks - perfect! – D. Lambert 2 days ago

Your Answer

 
discard

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.