Featured Video Plugin/Widget
January 15, 2008
Featured Video automatically features the latest video you include in a post in your sidebar.
Current Version: 1.2 (January 15, 2008)
Download: Download Featured Video Here
Wordpress Compatibility: Tested on 2.3.1, probably won’t work on less than 2.3
History:
This was a plugin that I looked and looked for when I was putting a new blog together for my Brother-in-law. He wanted to start vlogging, but he wanted to have a youtube video display in the sidebar that he didn’t have to change manually, instead he wanted it to change when he made a new post to the video category.
Well, as you can guess, I found a TON of “Easy Youtube” Post/Gallery plugins and the like, but nothing even came close to pulling a video out of a post and featuring it in the sidebar. And thus, Featured Video was born.
I based the code on Paul Bain’s EasyTube plugin, (Thanks Paul!) but modified it heavily to include the functionality I needed in addition to the easy youtube/google video posting that EasyTube provided. And then I widgetized it for added usability.
Installation Instructions:
Upload the featuredvideo.php file to your /wp-content/plugins folder, then log into your admin account, and go to the Plugins page and click “Activate” in the Featured Video row
Usage:
First, go to Options > Featured Video and set your options. You can choose the height and width of the control, whether or not you want it to autorun (not recommended, because it’s really annoying when it’s on every one of your pages), and the text for the link back to the post the video is from.
If you don’t want to display a link, you can simply leave the link box blank and it won’t display a link
To use Featured Video as a plugin:
Put <?php vsf_show_video() ?> in your theme’s sidebar file
To use Featured Video as a widget:
Point and click, baby. You can also set the title text if you want to
CSS Considerations:
The entire chunk of HTML generated by the Featured Video plugin is surrounded by <div class=”featuredvideo”>…<div> so it’s pretty easy to manipulate in CSS.
For example, if you wanted a bigger margin between the video and the link, and you wanted the link centered, try this:
.featuredvideo object {
margin-bottom: 5px;
}
.featuredvideo .link {
text-align: center;
}
(Since all designs are different, I can’t support the CSS on your site. If the above CSS doesn’t work for you, keep trying!)
Nuts and Bolts:
Just like Paul’s plugin, Featured Video will also parse all posts for the following syntax:
[youtube:url] and [googlevideo:url]
So, if you wanted to post a youtube video in your posts, you could use a line like this:
[youtube:http://www.youtube.com/watch?v=0md6Flcrd0s]
or Google Video:
[googlevideo:http://video.google.com/videoplay?docid=6204903272262158881]
If you use a [youtube or [googlevideo tag in any post, Featured Video will convert it to the required code for it to be displayed right there in the post. If you use one of those tags in a category that you’ve set in the Options page for Featured Video, it will display the first video from the most recent post wherever you put the <?php vsf_show_video() ?> code.
Happy blogging!
Known Bugs:
When you delete the latest post in one of the categories you have Featured Video set up to use, the plugin knows about it, but fires its’ update code before the post delete actually happens. Workaround: Simply go to the Options > Featured Video page and click the Update button and it will pick up the correct video.
Any ideas on how I can get around that without coding a whole extra function for the delete? This case wont happen very often, so an entire function seems a little overkill.
Because this plugin/widget is provided free of charge, I simply ask you to link back to Pressography.com in a post on your blog, or from one of your sites. It doesn't need to be anything fancy - just a note saying that you're using it, and whether or not you like it. However, there is no requirement that you do this, you're free to use the plugin regardless.



The plugin installed and is working perfectly for me on my site.
However, I’ve got a question. First, let me say I am no programmer or developer, and only tinker. I have no real understanding of php, but I’m learning (slowly).
I am fine using your short code of [youtube:url], but for a long time I’ve been using Viper’s Video Quick tags to embed videos into a post, and…for what it does, it’s great because you don’t have to remember codes. It puts buttons on the editor for YouTube and Google Video (and others). Click on the button, there’s a popup and you just paste in the URL. The generated syntax of the short code it uses are [youtube]url[/youtube] (same for Google).
So, I thought I’d be cute and see if I couldn’t make your plugin work Viper’s. (So, I understand if you’re not interested in helping with this…don’t worry about it.) So I’m thinking, OK, in his code, somewhere he set’s a parameter for your shortcode, so all I should have to do is change that to start with “[" (first character of the end code) and end with [/youtube]. Leave the rest of the code intact and it’ll work. Of course, it didn’t. I’m sure that doesn’t surprise you.
I changed line 74 to read: $regex = ‘/\[(youtube|googlevideo)](.*?)[/i';
Line 105 to read: $regex = '/\[youtube](.*?)[/i';
Line 138 to read: $regex = '/\[googlevideo](.*?)[/i’;
When it attempts to run, I get, in the article an error on line 106 and 139…again, something I’m sure you would expect.
Anyway, if you can quit laughing at my programming ignorance, and are so inclined, any direction would be great (it’s just a fun thing to do, and the way i’m trying to learn). Not critical, since you way works just fine for the purposes I need.
Thanks again for a great plugin.