I’ll be honest, a lot of the content I write here with WordPress code snippets is a lot about me remembering how to do things.
Today’s little trick is one that I’ve used a few times but have to go hunting for it every time I need it, now it’s here 🙂
When you use oEmbed in WordPress, you’re able to just copy and paste the URL of a video (think Youtube or Vimeo URL) directly into a page or post. When WordPress displays the page it will expand out the URL and show a video player.
Depending on your WordPress theme though the video may not take up the full width of your content area.
This first screen shot shows the problem, the video only takes up 2/3 of the column.
Take a look at this screen shot, this is what you’re after – the video is the same width as the column on content.
This is where this wee code snippet will come in handy.
// set the content width for oEmbeds in the site if ( ! isset( $content_width ) ) $content_width = 740;
All you have to do is change the 740 to the pixel width of your content column and it should work!
Good luck 🙂