Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Youtube dimensions wordpress

Is it possible to change the default embed dimensions of an youtube (or another video) in Wordpress for your current theme? I've searched for a plugin and some code, but I can't seem to find any.

What I mean is the default embed size used when you just paste an youtube url in an post or page.

like image 791
Matthijn Avatar asked Sep 30 '11 17:09

Matthijn


1 Answers

Open your theme’s functions.php file, and add the following code:

if ( ! isset( $content_width ) ) $content_width = 600;

Remember to change the number 600 appropriately for your theme. It is the maximum width in pixels for your content area.

Once you do this, WordPress will automatically use that for the maximum width of your oEmbed elements (youtube videos, slideshare, etc).

via wpbeginner.com

like image 72
gregmatys Avatar answered Oct 23 '22 12:10

gregmatys