Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 431 Vote(s) - 3.58 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Youtube dimensions wordpress

#1
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.
Reply

#2
To change the default embed size go to **Settings > Media** and just set a fixed width/height.

You also have the shortcode

[youtube=http://www.youtube.com/watch?v=0Bmhjf0rKe8&w=640&h=385]

where you can manually insert width and height as params. This shortcode will overwrite the default WP settings.
Reply

#3
They've got rid of the fixed width/height option in the media settings of the new version of Wordpress. Not sure why. It was useful!! Shortcodes don't seem to work either.
Reply

#4
The media settings have been removed. You can do it with a filter however.


function mycustom_embed_defaults($embed_size){

$embed_size['width'] = 600; // Adjust values to your needs
$embed_size['height'] = 500;

return $embed_size; // Return new size
}

add_filter('embed_defaults', 'mycustom_embed_defaults');

Taken from here

[To see links please register here]

Reply

#5
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][1]


[1]:

[To see links please register here]

Reply

#6
The currently accepted answer has an example that uses the following shortcode:

[youtube=http://www.youtube.com/watch?v=0Bmhjf0rKe8&w=640&h=385]

The shortcode `[youtube]` only works if you have [the Jetpack plugin](

[To see links please register here]

) installed.

To make it work with WordPress with no Jetpack you can use the built-in [`[embed]` shortcode](

[To see links please register here]

) like this:

[embed width=640 height=385]http://www.youtube.com/watch?v=0Bmhjf0rKe8[/embed]
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through