Videos via the video shortcode are always 640px wide?

I’ve run into a particular problem with the Video Shorcode of WP.

I can’t seem to change the size of the player with the attributes of the Shortcode.

Read More

This happens on multiple sites with multiple templates (Twenty Thirteen included).

Here’s the visual :

enter image description here

So I have 2 video tags, one with a width of 720 and the other with a width of 930.

enter image description here

In the page, they are both the same size (640px wide) even if they still have place in their container (see orange box by the developper tools, meaning that there’s untaken space on the right of the first video) and they both had different sizes over 640.

I don’t understand what is happening here. Do I give wrong arguments to the shortcode? I tried to give the width in pixels (720px) but had the same problem.

Related posts

1 comment

  1. That width is dictated by the $content_width global, defined by the Theme. To change it, you’ll need to hook into after_setup_theme and modify it:

    function wpse124075_setup_theme() {
        global $content_width;
        if ( ! isset( $content_width ) ) {
            $content_width = 640; // your value here, in pixels
        }
    }
    add_action( 'after_setup_theme', 'wpse124075_setup_theme' );
    

Comments are closed.