Topic: Video Thumbnails (WP-Plugin) Support
Just want to share my code for those who're in need.
I'm running a community with a video-section. Mostly videos hosted on blip.tv and vimeo are shown. I needed a solution to fetch thumbnails from my articles containing the embeded videos to be shown when viewing the video-category.
Yesterday I found this WP-plugin, it's called Video Thumbnails and can be found here: http://wordpress.org/extend/plugins/video-thumbnails/
I use the plugin together with the code I found here: http://www.arrastheme.com/forums/topic2 … based.html (post #4) - there, a custom field is used and you have to manually resize the thumbnail, so it's not really an "automatic" solution.
Here is my adapted code (arras/library/tapestries.php) - I'm using Arras 1.5.0.1. In tapestry.php at the very bottom search for
$postheader .= arras_get_thumbnail($tapestry . '-thumb'); and replace this line with following:
$video_thumbnail = get_video_thumbnail();
if($video_thumbnail){
$postheader .= "<img src='" . $video_thumbnail . "' width='195' />"; }
else
{
$postheader .= arras_get_thumbnail($tapestry . '-thumb'); }so finally the last lines of code in this file look like this:
/**
* Helper function to display headers for certain tapestries.
* @since 1.4.3
*/
function arras_generic_postheader($tapestry, $show_meta = false) {
global $post;
$postheader = '<div class="entry-thumbnails">';
$postheader .= '<a class="entry-thumbnails-link" href="' . get_permalink() . '">';
$video_thumbnail = get_video_thumbnail();
if($video_thumbnail){
$postheader .= "<img src='" . $video_thumbnail . "' width='195' />"; }
else
{
$postheader .= arras_get_thumbnail($tapestry . '-thumb'); }
if ($show_meta) {
$postheader .= '<span class="entry-meta"><span class="entry-comments">' . get_comments_number() . '</span>';
$postheader .= '<abbr class="published" title="' . get_the_time('c') . '">' . get_the_time( get_option('date_format') ) . '</abbr></span>';
}
$postheader .= '</a>';
$postheader .= '</div>';
$postheader .= '<h3 class="entry-title"><a href="' . get_permalink() . '" rel="bookmark">' . get_the_title() . '</a></h3>';
return $postheader;
}
/* End of file tapestries.php */
/* Location: ./library/tapestries.php */In addition to that, I tweaked my archive.php (arras/archive.php) to display different categories in different displays (videos are displayed in "default" mode). This is important - if you use another "mode" (traditional or archive_display) you have to adjust the thumbnail-width in the tapestries.php in this line.
$postheader .= "<img src='" . $video_thumbnail . "' width='195' />"; }So, if you install the Video Thumbnails plugin, just activate, write an article, embed a video (in the editor-window) from vimeo, youtube or blip.tv and save it.
After saving you will see the video-thumbnail and it's url somewhere on the right displayed in a widget (in my case the widget shows under "Featured Thumbnail"-widget. That's all. No need for uploading/downloading a thumbnail - just embed the video - that's it.
You can see a working example on my site: http://www.minemusig.at/blog/category/musigtv/
I'm not really a programmer, so no real support. For me, it works nice - hope it does for you, too - in case, say thank you
Greetings,
Harald
Last edited by noizeburger (2011-01-14 19:53:35)