By default, embedded YouTube videos are 425 pixels wide, which is wider than the content column on Choking on Popcorn. To be able to easily resize and add cool videos to that site I copy-pasted together a very basic plugin for WordPress. It allows you to simply use something like “["youtube ]xxxxxxxxx”["/youtube"]” to embed the video. The ‘xxxxxxxxx’ bit needs to be replaced with the actual video’s ID of course. I know there are tons of plugins that do similar things and are vastly superior, but this one suits my needs perfectly.
The output is valid XHTML, and you can adjust the display size by editing the plugin a bit. The entire thing is only a few lines so you’ll have no trouble finding the dimensions in the code. Simply use the options panel under Options -> Youtuber.
Feel free to download it and play around with it a bit. If you make improvements or can think of a cooler name for the plugin, please let me know.
Installation
- Download the zip file and unpack the file inside.
- Upload this file to the wp-content/plugins folder on your server.
- Activate it on WordPress’s ‘plugins’ tab.
To embed a video using the plugin, follow these steps:
- Find the video on YouTube.
- Extract the ID fromthe video page url. These look something like: http://youtube.com/watch?v=Krhl2o_uwdc. The bit I put in bold type is the ID.
- Type “["youtube "]“Krhl2o_uwdc”["/youtube"]“ anywhere in your post. Leave out the space in the first tag.
- Save and publish the post.
To change the display resolution for the videos:
- Go to Options -> Youtuber and type in the values that work for your blog.
Recent Comments