Version Description
- Added support for custom post types
Download this release
Release Info
Developer | sutherlandboswell |
Plugin | Video Thumbnails |
Version | 1.6 |
Comparing to | |
See all releases |
Code changes from version 1.5 to 1.6
- readme.txt +10 -4
- video-thumbnails.php +32 -4
readme.txt
CHANGED
@@ -4,13 +4,13 @@ Donate link: http://amzn.com/w/1L25YG6FO8AZ1
|
|
4 |
Tags: Video, YouTube, Vimeo, Blip.tv, Justin.tv, Thumbnails
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.1
|
7 |
-
Stable tag: 1.
|
8 |
|
9 |
Video Thumbnails simplifies the process of automatically displaying video thumbnails in your WordPress template.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
-
Video Thumbnails makes it easy to automatically display video thumbnails in your template.
|
14 |
|
15 |
Video Thumbnails currently supports these video services:
|
16 |
|
@@ -50,6 +50,10 @@ Yes, but be sure to include the post ID as a parameter. For example: `<?php $thu
|
|
50 |
|
51 |
If the service allows a way to retrieve thumbnails, I'll do my best to add it.
|
52 |
|
|
|
|
|
|
|
|
|
53 |
= I am editing my theme and only want to display a thumbnail if one is found. How do I do this? =
|
54 |
|
55 |
`<?php if( ( $video_thumbnail = get_video_thumbnail() ) != null ) { echo "<img src='" . $video_thumbnail . "' />"; } ?>` will only display a thumbnail when one exists.
|
@@ -78,6 +82,9 @@ The Vimeo API has a rate limit, so in rare cases you may exceed this limit. Try
|
|
78 |
|
79 |
== Changelog ==
|
80 |
|
|
|
|
|
|
|
81 |
= 1.5 =
|
82 |
* Video thumbnails are now only saved when a post's status changes to published.
|
83 |
* Removed URL field from the Video Thumbnail meta box on the Edit Post Page
|
@@ -183,8 +190,7 @@ This version adds the thumbnail URL to the post's meta data, meaning any outside
|
|
183 |
|
184 |
== Known Issues ==
|
185 |
|
186 |
-
*
|
187 |
-
* Posts with thumbnails manually set are overwritten by thumbnails found by the plugin, a solution is to save the post then select a different thumbnail without saving the whole post again
|
188 |
|
189 |
== Roadmap ==
|
190 |
|
4 |
Tags: Video, YouTube, Vimeo, Blip.tv, Justin.tv, Thumbnails
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.1
|
7 |
+
Stable tag: 1.6
|
8 |
|
9 |
Video Thumbnails simplifies the process of automatically displaying video thumbnails in your WordPress template.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
+
Video Thumbnails makes it easy to automatically display video thumbnails in your template. When you publish a post, this plugin will find the first video embedded and locate the thumbnail for you. Thumbnails can be saved to your media library and set as a featured image automatically. There's even support for custom post types!
|
14 |
|
15 |
Video Thumbnails currently supports these video services:
|
16 |
|
50 |
|
51 |
If the service allows a way to retrieve thumbnails, I'll do my best to add it.
|
52 |
|
53 |
+
= How do I use this plugin with custom post types? =
|
54 |
+
|
55 |
+
The settings page includes a checklist of all your post types so you can pick and choose.
|
56 |
+
|
57 |
= I am editing my theme and only want to display a thumbnail if one is found. How do I do this? =
|
58 |
|
59 |
`<?php if( ( $video_thumbnail = get_video_thumbnail() ) != null ) { echo "<img src='" . $video_thumbnail . "' />"; } ?>` will only display a thumbnail when one exists.
|
82 |
|
83 |
== Changelog ==
|
84 |
|
85 |
+
= 1.6 =
|
86 |
+
* Added support for custom post types
|
87 |
+
|
88 |
= 1.5 =
|
89 |
* Video thumbnails are now only saved when a post's status changes to published.
|
90 |
* Removed URL field from the Video Thumbnail meta box on the Edit Post Page
|
190 |
|
191 |
== Known Issues ==
|
192 |
|
193 |
+
* Because the plugin politely removes its settings when being deactivated, settings may revert back to the defaults when upgrading the plugin automatically. I believe this is an issue that will be fixed in WordPress 3.1.
|
|
|
194 |
|
195 |
== Roadmap ==
|
196 |
|
video-thumbnails.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://sutherlandboswell.com/2010/11/wordpress-video-thumbnails/
|
|
5 |
Description: Automatically retrieve video thumbnails for your posts and display them in your theme. Currently supports YouTube, Vimeo, Blip.tv, and Justin.tv.
|
6 |
Author: Sutherland Boswell
|
7 |
Author URI: http://sutherlandboswell.com
|
8 |
-
Version: 1.
|
9 |
License: GPL2
|
10 |
*/
|
11 |
/* Copyright 2010 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
@@ -243,7 +243,12 @@ function video_thumbnail($post_id=null) {
|
|
243 |
add_action("admin_init", "video_thumbnail_admin_init");
|
244 |
|
245 |
function video_thumbnail_admin_init(){
|
246 |
-
|
|
|
|
|
|
|
|
|
|
|
247 |
}
|
248 |
|
249 |
function video_thumbnail_admin(){
|
@@ -322,10 +327,17 @@ add_action('pending_to_publish', 'save_video_thumbnail', 10, 1);
|
|
322 |
add_action('future_to_publish', 'save_video_thumbnail', 10, 1);
|
323 |
|
324 |
function save_video_thumbnail( $post ){
|
|
|
|
|
325 |
if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) {
|
326 |
return null;
|
327 |
} else {
|
328 |
-
|
|
|
|
|
|
|
|
|
|
|
329 |
}
|
330 |
}
|
331 |
|
@@ -337,11 +349,13 @@ register_deactivation_hook(__FILE__,'video_thumbnails_deactivate');
|
|
337 |
function video_thumbnails_activate() {
|
338 |
add_option('video_thumbnails_save_media','1');
|
339 |
add_option('video_thumbnails_set_featured','1');
|
|
|
340 |
}
|
341 |
|
342 |
function video_thumbnails_deactivate() {
|
343 |
delete_option('video_thumbnails_save_media');
|
344 |
delete_option('video_thumbnails_set_featured');
|
|
|
345 |
}
|
346 |
|
347 |
// Check for cURL
|
@@ -397,6 +411,20 @@ function video_thumbnails_checkbox_option($option_name, $option_description) { ?
|
|
397 |
<th scope="row">Set as Featured Image</th>
|
398 |
<td><?php video_thumbnails_checkbox_option('video_thumbnails_set_featured', 'Automatically set thumbnail as featured image ("Save Thumbnail to Media" must be enabled)'); ?></td>
|
399 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
400 |
|
401 |
</table>
|
402 |
|
@@ -411,7 +439,7 @@ function video_thumbnails_checkbox_option($option_name, $option_description) { ?
|
|
411 |
<p>For more detailed instructions, check out the page for <a href="http://wordpress.org/extend/plugins/video-thumbnails/">Video Thumbnails on the official plugin directory</a>.</p>
|
412 |
|
413 |
<input type="hidden" name="action" value="update" />
|
414 |
-
<input type="hidden" name="page_options" value="video_thumbnails_save_media,video_thumbnails_set_featured" />
|
415 |
|
416 |
</form>
|
417 |
|
5 |
Description: Automatically retrieve video thumbnails for your posts and display them in your theme. Currently supports YouTube, Vimeo, Blip.tv, and Justin.tv.
|
6 |
Author: Sutherland Boswell
|
7 |
Author URI: http://sutherlandboswell.com
|
8 |
+
Version: 1.6
|
9 |
License: GPL2
|
10 |
*/
|
11 |
/* Copyright 2010 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
243 |
add_action("admin_init", "video_thumbnail_admin_init");
|
244 |
|
245 |
function video_thumbnail_admin_init(){
|
246 |
+
$video_thumbnails_post_types = get_option('video_thumbnails_post_types');
|
247 |
+
if(is_array($video_thumbnails_post_types)) {
|
248 |
+
foreach ($video_thumbnails_post_types as $type) {
|
249 |
+
add_meta_box("video_thumbnail", "Video Thumbnail", "video_thumbnail_admin", $type, "side", "low");
|
250 |
+
}
|
251 |
+
}
|
252 |
}
|
253 |
|
254 |
function video_thumbnail_admin(){
|
327 |
add_action('future_to_publish', 'save_video_thumbnail', 10, 1);
|
328 |
|
329 |
function save_video_thumbnail( $post ){
|
330 |
+
$post_type = get_post_type( $post->ID );
|
331 |
+
$video_thumbnails_post_types = get_option('video_thumbnails_post_types');
|
332 |
if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) {
|
333 |
return null;
|
334 |
} else {
|
335 |
+
// Check that Video Thumbnails are enabled for current post type
|
336 |
+
if (in_array($post_type, $video_thumbnails_post_types) OR $post_type == $video_thumbnails_post_types) {
|
337 |
+
get_video_thumbnail($post->ID);
|
338 |
+
} else {
|
339 |
+
return null;
|
340 |
+
}
|
341 |
}
|
342 |
}
|
343 |
|
349 |
function video_thumbnails_activate() {
|
350 |
add_option('video_thumbnails_save_media','1');
|
351 |
add_option('video_thumbnails_set_featured','1');
|
352 |
+
add_option('video_thumbnails_post_types',array('post'));
|
353 |
}
|
354 |
|
355 |
function video_thumbnails_deactivate() {
|
356 |
delete_option('video_thumbnails_save_media');
|
357 |
delete_option('video_thumbnails_set_featured');
|
358 |
+
delete_option('video_thumbnails_post_types');
|
359 |
}
|
360 |
|
361 |
// Check for cURL
|
411 |
<th scope="row">Set as Featured Image</th>
|
412 |
<td><?php video_thumbnails_checkbox_option('video_thumbnails_set_featured', 'Automatically set thumbnail as featured image ("Save Thumbnail to Media" must be enabled)'); ?></td>
|
413 |
</tr>
|
414 |
+
|
415 |
+
<tr valign="top">
|
416 |
+
<th scope="row">Post Types</th>
|
417 |
+
<td>
|
418 |
+
<?php $video_thumbnails_post_types = get_option('video_thumbnails_post_types'); ?>
|
419 |
+
<?php foreach(get_post_types() as $type): if($type == 'attachment' OR $type == 'revision' OR $type == 'nav_menu_item') continue; ?>
|
420 |
+
<label for="video_thumbnails_post_types_<?php echo $type; ?>">
|
421 |
+
<input id="video_thumbnails_post_types_<?php echo $type; ?>" name="video_thumbnails_post_types[]" type="checkbox" value="<?php echo $type; ?>" <?php if(is_array($video_thumbnails_post_types)) checked(in_array($type, $video_thumbnails_post_types)); ?> />
|
422 |
+
<?php echo $type; ?>
|
423 |
+
</label>
|
424 |
+
<br />
|
425 |
+
<?php endforeach; ?>
|
426 |
+
</td>
|
427 |
+
</tr>
|
428 |
|
429 |
</table>
|
430 |
|
439 |
<p>For more detailed instructions, check out the page for <a href="http://wordpress.org/extend/plugins/video-thumbnails/">Video Thumbnails on the official plugin directory</a>.</p>
|
440 |
|
441 |
<input type="hidden" name="action" value="update" />
|
442 |
+
<input type="hidden" name="page_options" value="video_thumbnails_save_media,video_thumbnails_set_featured,video_thumbnails_post_types" />
|
443 |
|
444 |
</form>
|
445 |
|