Version Description
- Video thumbnails can be retrieved for a specific post ID by passing a parameter to the
video_thumbnail()
orget_video_thumbnail()
function. For example: `<?php $id
Download this release
Release Info
Developer | sutherlandboswell |
Plugin | Video Thumbnails |
Version | 0.5.4 |
Comparing to | |
See all releases |
Code changes from version 0.5.3 to 0.5.4
- readme.txt +12 -4
- video-thumbnails.php +13 -10
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://sutherlandboswell.com/2010/11/wordpress-video-thumbnails/
|
|
4 |
Tags: Video, YouTube, Vimeo, Blip.tv, Thumbnails
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.0.2
|
7 |
-
Stable tag: 0.5.
|
8 |
|
9 |
Video Thumbnails is a simple plugin that makes it easy to automatically display video thumbnails in your template.
|
10 |
|
@@ -35,7 +35,11 @@ For more advanced users, the `get_video_thumbnail()` function will return null w
|
|
35 |
|
36 |
= Why doesn't the thumbnail show up in the meta box on the Edit Post page after I save it? =
|
37 |
|
38 |
-
This is probably happening because `video_thumbnail()` or `get_video_thumbnail()` has not be used in a loop for that post yet. Try loading a page that calls for the thumbnail then checking the Edit Post page again. This will be fixed
|
|
|
|
|
|
|
|
|
39 |
|
40 |
= My video service/embedding plugin isn't included, can you add it? =
|
41 |
|
@@ -51,6 +55,9 @@ In version 0.2 `get_video_thumbnail()` was added which returns null when no thum
|
|
51 |
|
52 |
== Changelog ==
|
53 |
|
|
|
|
|
|
|
54 |
= 0.5.3 =
|
55 |
* Better support for Vimeo Shortcode (thanks to Darren for the tip)
|
56 |
|
@@ -106,7 +113,8 @@ This version adds the thumbnail URL to the post's meta data, meaning any outside
|
|
106 |
|
107 |
This plugin is still very young, and has a future planned as the ultimate plugin for video thumbnails. Here's some of the planned additions:
|
108 |
|
|
|
109 |
* More comprehensive Blip.tv support
|
110 |
-
* Local thumbnail caching
|
111 |
* More services
|
112 |
-
*
|
|
4 |
Tags: Video, YouTube, Vimeo, Blip.tv, Thumbnails
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.0.2
|
7 |
+
Stable tag: 0.5.4
|
8 |
|
9 |
Video Thumbnails is a simple plugin that makes it easy to automatically display video thumbnails in your template.
|
10 |
|
35 |
|
36 |
= Why doesn't the thumbnail show up in the meta box on the Edit Post page after I save it? =
|
37 |
|
38 |
+
This is probably happening because `video_thumbnail()` or `get_video_thumbnail()` has not be used in a loop for that post yet. Try loading a page that calls for the thumbnail then checking the Edit Post page again. This will be fixed soon.
|
39 |
+
|
40 |
+
= Can I use the functions outside of a loop? =
|
41 |
+
|
42 |
+
Yes, but you must pass the post ID to the function as a parameter. For example: `<?php $id = 25; $thumbnail = get_video_thumbnail($id); if($thumbnail!=null) echo $thumbnail; ?>`
|
43 |
|
44 |
= My video service/embedding plugin isn't included, can you add it? =
|
45 |
|
55 |
|
56 |
== Changelog ==
|
57 |
|
58 |
+
= 0.5.4 =
|
59 |
+
* Video thumbnails can be retrieved for a specific post ID by passing a parameter to the `video_thumbnail()` or `get_video_thumbnail()` function. For example: `<?php $id = 25; $thumbnail = get_video_thumbnail($id); if($thumbnail!=null) echo $thumbnail; ?>`
|
60 |
+
|
61 |
= 0.5.3 =
|
62 |
* Better support for Vimeo Shortcode (thanks to Darren for the tip)
|
63 |
|
113 |
|
114 |
This plugin is still very young, and has a future planned as the ultimate plugin for video thumbnails. Here's some of the planned additions:
|
115 |
|
116 |
+
* An option to save thumbnails as post attachments and as the featured image, giving the plugin out-of-the-box compatibility with themes that use the Featured Image functionality of WordPress (I'd like some feedback on this idea)
|
117 |
* More comprehensive Blip.tv support
|
|
|
118 |
* More services
|
119 |
+
* Broader plugin compatibility
|
120 |
+
* Option to display video thumbnails on the admin post list page
|
video-thumbnails.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://sutherlandboswell.com/2010/11/wordpress-video-thumbnails/
|
|
5 |
Description: Make adding video thumbnails to your posts easier and automatic, just add <code><?php video_thumbnail(); ?></code> to your loop to get the thumbnail's URL. <code><?php get_video_thumbnail(); ?></code> is also available for more advanced users. Currently works with YouTube, Vimeo, and Blip.tv, along with several embedding plugins.
|
6 |
Author: Sutherland Boswell
|
7 |
Author URI: http://sutherlandboswell.com
|
8 |
-
Version: 0.5.
|
9 |
License: GPL2
|
10 |
*/
|
11 |
/* Copyright 2010 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
@@ -47,24 +47,27 @@ function getBliptvInfo($id) {
|
|
47 |
}
|
48 |
|
49 |
// The Main Event
|
50 |
-
function get_video_thumbnail() {
|
|
|
|
|
|
|
51 |
|
52 |
// Check to see if thumbnail has already been found
|
53 |
-
$
|
54 |
-
if( ($thumbnail_meta = get_post_meta($postid, '_video_thumbnail', true)) != '' ) {
|
55 |
return $thumbnail_meta;
|
56 |
}
|
57 |
// If the thumbnail isn't stored in custom meta, fetch a thumbnail
|
58 |
else {
|
59 |
|
60 |
// Gets the post's content
|
61 |
-
$
|
|
|
62 |
$new_thumbnail = null;
|
63 |
|
64 |
// Simple Video Embedder Compatibility
|
65 |
if(function_exists('p75HasVideo')) {
|
66 |
-
if ( p75HasVideo($
|
67 |
-
$markup = p75GetVideo($
|
68 |
}
|
69 |
}
|
70 |
|
@@ -150,7 +153,7 @@ function get_video_thumbnail() {
|
|
150 |
|
151 |
// Return the new thumbnail variable and update meta if one is found
|
152 |
if($new_thumbnail!=null) {
|
153 |
-
if(!update_post_meta($
|
154 |
}
|
155 |
return $new_thumbnail;
|
156 |
|
@@ -158,8 +161,8 @@ function get_video_thumbnail() {
|
|
158 |
};
|
159 |
|
160 |
// Echo thumbnail
|
161 |
-
function video_thumbnail() {
|
162 |
-
if( ( $video_thumbnail = get_video_thumbnail() ) == null ) { echo plugins_url() . "/video-thumbnails/default.jpg"; }
|
163 |
else { echo $video_thumbnail; }
|
164 |
};
|
165 |
|
5 |
Description: Make adding video thumbnails to your posts easier and automatic, just add <code><?php video_thumbnail(); ?></code> to your loop to get the thumbnail's URL. <code><?php get_video_thumbnail(); ?></code> is also available for more advanced users. Currently works with YouTube, Vimeo, and Blip.tv, along with several embedding plugins.
|
6 |
Author: Sutherland Boswell
|
7 |
Author URI: http://sutherlandboswell.com
|
8 |
+
Version: 0.5.4
|
9 |
License: GPL2
|
10 |
*/
|
11 |
/* Copyright 2010 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
47 |
}
|
48 |
|
49 |
// The Main Event
|
50 |
+
function get_video_thumbnail($post_id=null) {
|
51 |
+
|
52 |
+
// Get the post ID if none is provided
|
53 |
+
if($post_id==null OR $post_id=='') $post_id = get_the_ID();
|
54 |
|
55 |
// Check to see if thumbnail has already been found
|
56 |
+
if( ($thumbnail_meta = get_post_meta($post_id, '_video_thumbnail', true)) != '' ) {
|
|
|
57 |
return $thumbnail_meta;
|
58 |
}
|
59 |
// If the thumbnail isn't stored in custom meta, fetch a thumbnail
|
60 |
else {
|
61 |
|
62 |
// Gets the post's content
|
63 |
+
$post_array = get_post($post_id);
|
64 |
+
$markup = $post_array->post_content;
|
65 |
$new_thumbnail = null;
|
66 |
|
67 |
// Simple Video Embedder Compatibility
|
68 |
if(function_exists('p75HasVideo')) {
|
69 |
+
if ( p75HasVideo($post_id) ) {
|
70 |
+
$markup = p75GetVideo($post_id);
|
71 |
}
|
72 |
}
|
73 |
|
153 |
|
154 |
// Return the new thumbnail variable and update meta if one is found
|
155 |
if($new_thumbnail!=null) {
|
156 |
+
if(!update_post_meta($post_id, '_video_thumbnail', $new_thumbnail)) add_post_meta($post_id, '_video_thumbnail', $new_thumbnail);
|
157 |
}
|
158 |
return $new_thumbnail;
|
159 |
|
161 |
};
|
162 |
|
163 |
// Echo thumbnail
|
164 |
+
function video_thumbnail($post_id=null) {
|
165 |
+
if( ( $video_thumbnail = get_video_thumbnail($post_id) ) == null ) { echo plugins_url() . "/video-thumbnails/default.jpg"; }
|
166 |
else { echo $video_thumbnail; }
|
167 |
};
|
168 |
|