316 posts
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Has been part of the Envato Community for over 3 years
+2 more
SyamilMJ says

Basically I’m trying to add support for Screenr for the built-in oEmbed protocol using this:

wp_oembed_add_provider( '#http://(www\.)?screenr\.com/.*#i', 'http://www.screenr.com/api/oembed.json', true ); // Screenr

Now whenever I try to use, for example:

[embed width="560"]http://www.screenr.com/WbZs[/embed]

The embed code outputs just fine except that it doesn’t respect the defined width. The output for the above code is:

<iframe src="http://www.screenr.com/embed/udcs" frameborder="0" height="396" width="650"></iframe>

Is there any way I could fix this?

214 posts
  • Has referred 1+ members
  • Has collected 50+ items on Envato Market
  • Has been part of the Envato Community for over 6 years
  • Sells items exclusively on Envato Market
agusmu says
316 posts
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Has been part of the Envato Community for over 3 years
+2 more
SyamilMJ says

That works for other videos, but screenr just returns nothing. Here’s how I call it:

/*-----------------------------------------------------------------------------------*/
/* Video Wrapper - [video width=""] url [/video]
/*-----------------------------------------------------------------------------------*/

function aq_shortcode_video_wrapper($atts, $content = null) {

    global $wp_embed, $content_width;

    $defaults = array(
        'align' => '',
        'width'    => 590,
    );

    extract( shortcode_atts( $defaults, $atts ) );

    $content_width = $width;
    $embed_code = $wp_embed->autoembed($content);    

    //$embed_code = wp_oembed_get( $content, array('width' => $width)  );

    $output = '';

    if ($width)
        $output = '<div class="aq-video-wrapper radius3 cf '.$align.'" style="width:'.$width.'px;">' . $embed_code . '</div>';

    return $output;
}

add_shortcode( 'video', 'aq_shortcode_video_wrapper' );

Funnily, if you use $wp_embed->shortcode($id,$url) as explained in this tutorial, it will output the video but the width remains unchanged.

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by