WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I used this changes to functions.php that are written in this post: TED talks shortcode not working

But I can't figure out how to control the size/ratio now. The video is embedding as way taller than it is wide. Any fix for this??

share|improve this question
Have you made any effort at fixing this yourself? – s_ha_dum Jan 14 '13 at 21:37
I looked at the php fix and wasn't sure how to add in size conditions. I don't know how to write that. – Jess Jan 14 '13 at 23:36
We have to dig into other Questions/links to find the actual code you are using? And probably will not be exactly as you are using it... Please, post the relevant code to the Question itself. – brasofilo Jan 15 '13 at 7:55

You can control the size of the embedded TED video by using the shortcode:

[ted id="1650" width="300" height="200"]

If you want to have it predefined, you can use:

    $atts['width']=600; // Default width
    $atts['height']=400; // Default height

so the code here will be:

// 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;

    // width:
     $atts['width']=600; // Default width

    // height:
     $atts['height']=400; // Default height

    // 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' );
share|improve this answer

Your Answer


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.