Version Description
- Tested with the latest wordpress release.
Download this release
Release Info
Developer | tariquesani |
Plugin | Auto Post Thumbnail |
Version | 3.4.0 |
Comparing to | |
See all releases |
Code changes from version 3.3.3 to 3.4.0
- auto-post-thumbnail.php +14 -9
- readme.txt +7 -4
auto-post-thumbnail.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
Plugin Name: Auto Post Thumbnail
|
5 |
Plugin URI: http://www.sanisoft.com/blog/2010/04/19/wordpress-plugin-automatic-post-thumbnail/
|
6 |
Description: Automatically generate the Post Thumbnail (Featured Thumbnail) from the first image in post (or any custom post type) only if Post Thumbnail is not set manually.
|
7 |
-
Version: 3.3.
|
8 |
Author: Aditya Mooley <adityamooley@sanisoft.com>, Tarique Sani <tarique@sanisoft.com>
|
9 |
Author URI: http://www.sanisoft.com/blog/author/adityamooley/
|
10 |
Modified by Dr. Tarique Sani <tarique@sanisoft.com> to make it work with Wordpress 3.4
|
@@ -195,12 +195,12 @@ function apt_admin_enqueues($hook_suffix) {
|
|
195 |
}
|
196 |
|
197 |
// WordPress 3.1 vs older version compatibility
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
|
205 |
wp_enqueue_style( 'style', plugins_url( 'css/style.css', __FILE__ ) );
|
206 |
|
@@ -294,13 +294,18 @@ function apt_publish_post($post_id)
|
|
294 |
* Look for this id in the IMG tag.
|
295 |
*/
|
296 |
preg_match('/wp-image-([\d]*)/i', $image, $thumb_id);
|
297 |
-
$thumb_id
|
|
|
|
|
298 |
|
299 |
// If thumb id is not found, try to look for the image in DB. Thanks to "Erwin Vrolijk" for providing this code.
|
300 |
if (!$thumb_id) {
|
301 |
$image = substr($image, strpos($image, '"')+1);
|
302 |
$result = $wpdb->get_results("SELECT ID FROM {$wpdb->posts} WHERE guid = '".$image."'");
|
303 |
-
$
|
|
|
|
|
|
|
304 |
}
|
305 |
|
306 |
// Ok. Still no id found. Some other way used to insert the image in post. Now we must fetch the image from URL and do the needful.
|
4 |
Plugin Name: Auto Post Thumbnail
|
5 |
Plugin URI: http://www.sanisoft.com/blog/2010/04/19/wordpress-plugin-automatic-post-thumbnail/
|
6 |
Description: Automatically generate the Post Thumbnail (Featured Thumbnail) from the first image in post (or any custom post type) only if Post Thumbnail is not set manually.
|
7 |
+
Version: 3.3.4
|
8 |
Author: Aditya Mooley <adityamooley@sanisoft.com>, Tarique Sani <tarique@sanisoft.com>
|
9 |
Author URI: http://www.sanisoft.com/blog/author/adityamooley/
|
10 |
Modified by Dr. Tarique Sani <tarique@sanisoft.com> to make it work with Wordpress 3.4
|
195 |
}
|
196 |
|
197 |
// WordPress 3.1 vs older version compatibility
|
198 |
+
if ( wp_script_is( 'jquery-ui-widget', 'registered' ) ) {
|
199 |
+
wp_enqueue_script( 'jquery-ui-progressbar', plugins_url( 'jquery-ui/jquery.ui.progressbar.min.js', __FILE__ ), array( 'jquery-ui-core', 'jquery-ui-widget' ), '1.7.2' );
|
200 |
+
}
|
201 |
+
else {
|
202 |
+
wp_enqueue_script( 'jquery-ui-progressbar', plugins_url( 'jquery-ui/ui.progressbar.js', __FILE__ ), array( 'jquery-ui-core' ), '1.7.2' );
|
203 |
+
}
|
204 |
|
205 |
wp_enqueue_style( 'style', plugins_url( 'css/style.css', __FILE__ ) );
|
206 |
|
294 |
* Look for this id in the IMG tag.
|
295 |
*/
|
296 |
preg_match('/wp-image-([\d]*)/i', $image, $thumb_id);
|
297 |
+
if($thumb_id){
|
298 |
+
$thumb_id = $thumb_id[1];
|
299 |
+
}
|
300 |
|
301 |
// If thumb id is not found, try to look for the image in DB. Thanks to "Erwin Vrolijk" for providing this code.
|
302 |
if (!$thumb_id) {
|
303 |
$image = substr($image, strpos($image, '"')+1);
|
304 |
$result = $wpdb->get_results("SELECT ID FROM {$wpdb->posts} WHERE guid = '".$image."'");
|
305 |
+
if($result){
|
306 |
+
$thumb_id = $result[0]->ID;
|
307 |
+
}
|
308 |
+
|
309 |
}
|
310 |
|
311 |
// Ok. Still no id found. Some other way used to insert the image in post. Now we must fetch the image from URL and do the needful.
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== Auto Post Thumbnail ===
|
2 |
-
Contributors:
|
3 |
Tags: Post, thumbnail, automatic, posts, featured image, image, featured, images, admin
|
4 |
-
Requires at least:
|
5 |
-
Tested up to:
|
6 |
-
Stable tag: 3.
|
7 |
|
8 |
Automatically generate the Post Thumbnail (Featured Thumbnail) from the first image in post or any custom post type only if Post Thumbnail is not set manually.
|
9 |
|
@@ -27,6 +27,9 @@ For more details, see http://www.sanisoft.com/blog/2010/04/19/wordpress-plugin-a
|
|
27 |
|
28 |
== Changelog ==
|
29 |
|
|
|
|
|
|
|
30 |
= 3.3.3 =
|
31 |
* Fix for SQL error begin caused due to no ID
|
32 |
|
1 |
=== Auto Post Thumbnail ===
|
2 |
+
Contributors: tariquesani
|
3 |
Tags: Post, thumbnail, automatic, posts, featured image, image, featured, images, admin
|
4 |
+
Requires at least: 3.6.1
|
5 |
+
Tested up to: 4.4.x
|
6 |
+
Stable tag: 3.4.0
|
7 |
|
8 |
Automatically generate the Post Thumbnail (Featured Thumbnail) from the first image in post or any custom post type only if Post Thumbnail is not set manually.
|
9 |
|
27 |
|
28 |
== Changelog ==
|
29 |
|
30 |
+
= 3.4.0 =
|
31 |
+
* Tested with the latest wordpress release.
|
32 |
+
|
33 |
= 3.3.3 =
|
34 |
* Fix for SQL error begin caused due to no ID
|
35 |
|