In this screencast I’ll show you how to embed YouTube and Vimeo videos into your WordPress posts. There’s no need to copy and paste code snippets and position them anymore, thanks to a technology called oEmbed (sometimes called auto embed).
WordPress parses the URL to your videos and adds the code needed to display those automatically – it even adjusts the width (if supported by your theme).
oEmbed works with a variety of services, and while I’m at it I’ll show you how to embed items from YouTube, Vimeo, Flickr and Twitter. For a full list of supported services take a look at this:
I was investigating an interring issue today: YouTube videos I was embedding on this very site did not fill the whole width of my theme. They were 500 pixels wide, and I know that P2 supports something a bit larger than that.
It didn’t really bother me, until I thought that embeds on my other site which is also using P2 look so much better. What was going on? What was the other site doing that this one wasn’t?
Turns out there are actually three different things to watch out for, and I’ll tell you about each one in a moment.
I remember vividly that there was an option under Settings – Media where you could set how wide and tall your auto embeds should be – but as of WordPress 3.5 this has been removed. If your website has been around for a while (like mine has) then these residual values may still be in the database and WordPress may still use them – as was the problem in my case.