Version Description
- Tested with WordPress-3.6.x
- Small tweaks
Download this release
Release Info
Developer | tariquesani |
Plugin | Auto Post Thumbnail |
Version | 3.3.2 |
Comparing to | |
See all releases |
Code changes from version 3.3.1 to 3.3.2
- auto-post-thumbnail.php +120 -85
- css/style.css +47 -0
- img/apt_logo.jpg +0 -0
- readme.txt +6 -3
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
|
@@ -27,7 +27,6 @@ Modified by Dr. Tarique Sani <tarique@sanisoft.com> to make it work with Wordpre
|
|
27 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
28 |
*/
|
29 |
|
30 |
-
|
31 |
add_action('publish_post', 'apt_publish_post');
|
32 |
|
33 |
// This hook will now handle all sort publishing including posts, custom types, scheduled posts, etc.
|
@@ -54,98 +53,132 @@ function apt_add_admin_menu() {
|
|
54 |
function apt_interface() {
|
55 |
global $wpdb;
|
56 |
?>
|
57 |
-
<div
|
|
|
|
|
|
|
58 |
|
59 |
-
<div class="wrap genpostthumbs">
|
60 |
-
|
61 |
|
62 |
<?php
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
?>
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
-
<script type="text/javascript">
|
98 |
-
// <![CDATA[
|
99 |
-
jQuery(document).ready(function($){
|
100 |
-
var i;
|
101 |
-
var rt_images = [<?php echo $ids; ?>];
|
102 |
-
var rt_total = rt_images.length;
|
103 |
-
var rt_count = 1;
|
104 |
-
var rt_percent = 0;
|
105 |
-
|
106 |
-
$("#genpostthumbsbar").progressbar();
|
107 |
-
$("#genpostthumbsbar-percent").html( "0%" );
|
108 |
-
|
109 |
-
function genPostThumb( id ) {
|
110 |
-
$.post( "admin-ajax.php", { action: "generatepostthumbnail", id: id }, function() {
|
111 |
-
rt_percent = ( rt_count / rt_total ) * 100;
|
112 |
-
$("#genpostthumbsbar").progressbar( "value", rt_percent );
|
113 |
-
$("#genpostthumbsbar-percent").html( Math.round(rt_percent) + "%" );
|
114 |
-
rt_count = rt_count + 1;
|
115 |
-
|
116 |
-
if ( rt_images.length ) {
|
117 |
genPostThumb( rt_images.shift() );
|
118 |
-
}
|
119 |
-
|
120 |
-
|
121 |
-
}
|
122 |
-
|
123 |
-
});
|
124 |
-
}
|
125 |
-
|
126 |
-
genPostThumb( rt_images.shift() );
|
127 |
-
});
|
128 |
-
// ]]>
|
129 |
-
</script>
|
130 |
<?php
|
131 |
-
|
132 |
-
|
133 |
?>
|
134 |
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
<?php wp_nonce_field('generate-post-thumbnails') ?>
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
<?php } ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
</div>
|
150 |
<?php
|
151 |
} //End apt_interface()
|
@@ -169,6 +202,8 @@ function apt_admin_enqueues($hook_suffix) {
|
|
169 |
wp_enqueue_script( 'jquery-ui-progressbar', plugins_url( 'jquery-ui/ui.progressbar.js', __FILE__ ), array( 'jquery-ui-core' ), '1.7.2' );
|
170 |
}
|
171 |
|
|
|
|
|
172 |
wp_enqueue_style( 'jquery-ui-genpostthumbs', plugins_url( 'jquery-ui/redmond/jquery-ui-1.7.2.custom.css', __FILE__ ), array(), '1.7.2' );
|
173 |
} //End apt_admin_enqueues
|
174 |
|
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.2
|
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
|
27 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
28 |
*/
|
29 |
|
|
|
30 |
add_action('publish_post', 'apt_publish_post');
|
31 |
|
32 |
// This hook will now handle all sort publishing including posts, custom types, scheduled posts, etc.
|
53 |
function apt_interface() {
|
54 |
global $wpdb;
|
55 |
?>
|
56 |
+
<div>
|
57 |
+
<div style="margin-right:260px;">
|
58 |
+
<div style='float:left; width: 100%'>
|
59 |
+
<div id="message" class="updated fade" style="display:none"></div>
|
60 |
|
61 |
+
<div class="wrap genpostthumbs">
|
62 |
+
<h2>Generate Post Thumbnails</h2>
|
63 |
|
64 |
<?php
|
65 |
+
// If the button was clicked
|
66 |
+
if ( !empty($_POST['generate-post-thumbnails']) ) {
|
67 |
+
// Capability check
|
68 |
+
if ( !current_user_can('manage_options') )
|
69 |
+
wp_die('Cheatin’ uh?');
|
70 |
+
|
71 |
+
// Form nonce check
|
72 |
+
check_admin_referer( 'generate-post-thumbnails' );
|
73 |
+
|
74 |
+
// Get id's of all the published posts for which post thumbnails does not exist.
|
75 |
+
$query = "SELECT * FROM {$wpdb->posts} p where p.post_status = 'publish' AND p.ID NOT IN (
|
76 |
+
SELECT DISTINCT post_id FROM {$wpdb->postmeta} WHERE meta_key IN (' _thumbnail_id', 'skip_post_thumb')
|
77 |
+
)";
|
78 |
+
$posts = $wpdb->get_results($query);
|
79 |
+
|
80 |
+
if (empty($posts)) {
|
81 |
+
echo '<p>Currently there are no published posts available to generate thumbnails.</p>';
|
82 |
+
} else {
|
83 |
+
echo '<p>We are generating post thumbnails. Please be patient!</p>';
|
84 |
+
|
85 |
+
// Generate the list of IDs
|
86 |
+
$ids = array();
|
87 |
+
foreach ( $posts as $post )
|
88 |
+
$ids[] = $post->ID;
|
89 |
+
$ids = implode( ',', $ids );
|
90 |
+
|
91 |
+
$count = count( $posts );
|
92 |
?>
|
93 |
+
<noscript><p><em>You must enable Javascript in order to proceed!</em></p></noscript>
|
94 |
+
|
95 |
+
<div id="genpostthumbsbar" style="position:relative;height:25px;">
|
96 |
+
<div id="genpostthumbsbar-percent" style="position:absolute;left:50%;top:50%;width:50px;margin-left:-25px;height:25px;margin-top:-9px;font-weight:bold;text-align:center;"></div>
|
97 |
+
</div>
|
98 |
+
|
99 |
+
<script type="text/javascript">
|
100 |
+
// <![CDATA[
|
101 |
+
jQuery(document).ready(function($){
|
102 |
+
var i;
|
103 |
+
var rt_images = [<?php echo $ids; ?>];
|
104 |
+
var rt_total = rt_images.length;
|
105 |
+
var rt_count = 1;
|
106 |
+
var rt_percent = 0;
|
107 |
+
|
108 |
+
$("#genpostthumbsbar").progressbar();
|
109 |
+
$("#genpostthumbsbar-percent").html( "0%" );
|
110 |
+
|
111 |
+
function genPostThumb( id ) {
|
112 |
+
$.post( "admin-ajax.php", { action: "generatepostthumbnail", id: id }, function() {
|
113 |
+
rt_percent = ( rt_count / rt_total ) * 100;
|
114 |
+
$("#genpostthumbsbar").progressbar( "value", rt_percent );
|
115 |
+
$("#genpostthumbsbar-percent").html( Math.round(rt_percent) + "%" );
|
116 |
+
rt_count = rt_count + 1;
|
117 |
+
|
118 |
+
if ( rt_images.length ) {
|
119 |
+
genPostThumb( rt_images.shift() );
|
120 |
+
} else {
|
121 |
+
$("#message").html("<p><strong><?php echo js_escape( sprintf('All done! Processed %d posts.', $count ) ); ?></strong></p>");
|
122 |
+
$("#message").show();
|
123 |
+
}
|
124 |
+
|
125 |
+
});
|
126 |
+
}
|
127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
genPostThumb( rt_images.shift() );
|
129 |
+
});
|
130 |
+
// ]]>
|
131 |
+
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
<?php
|
133 |
+
}
|
134 |
+
} else {
|
135 |
?>
|
136 |
|
137 |
+
<p>Use this tool to generate Post Thumbnail (Featured Thumbnail) for your Published posts.</p>
|
138 |
+
<p>If the script stops executing for any reason, just <strong>Reload</strong> the page and it will continue from where it stopped.</p>
|
139 |
+
|
140 |
+
<form method="post" action="">
|
141 |
+
<?php wp_nonce_field('generate-post-thumbnails') ?>
|
142 |
+
|
143 |
+
|
144 |
+
<p><input type="submit" class="button hide-if-no-js" name="generate-post-thumbnails" id="generate-post-thumbnails" value="Generate Thumbnails" /></p>
|
145 |
+
|
146 |
+
<noscript><p><em>You must enable Javascript in order to proceed!</em></p></noscript>
|
147 |
+
|
148 |
+
</form>
|
149 |
+
<p>Note: Thumbnails won't be generated for posts that already have post thumbnail or <strong><em>skip_post_thumb</em></strong> custom field set.</p>
|
150 |
+
<?php } ?>
|
151 |
+
</div>
|
152 |
+
</div>
|
153 |
+
<?php if( !is_plugin_active( 'auto-post-thumbnail-pro/index.php' ) ) { ?>
|
154 |
+
<div class="apt_pro_advertisement">
|
155 |
+
<div>
|
156 |
+
<div class="apt_pro_logo">
|
157 |
+
<img align="middle" src=" <?php echo plugins_url( 'img/apt_logo.jpg' , __FILE__); ?>" />
|
158 |
+
</div>
|
159 |
+
<div class="apt_pro_check_out"><i>Upgrade Now</i></div>
|
160 |
+
</div>
|
161 |
+
<div class="apt_pro_features">
|
162 |
+
<ul>
|
163 |
+
<li>Auto set first image in post as featured</li>
|
164 |
+
<li>Auto set first attachment as featured</li>
|
165 |
+
<li>Featured images from videos</li>
|
166 |
+
<li>Several video services supported</li>
|
167 |
+
<li>External images, shortcode ready</li>
|
168 |
+
<li>Support for Custom Post Type</li>
|
169 |
+
<li>Ability to delete featured images</li>
|
170 |
+
<li>Multilingual ready</li>
|
171 |
+
<li>Free updates, guaranteed support</li>
|
172 |
+
<li>Works with any theme</li>
|
173 |
+
<li>Very reasonably priced</li>
|
174 |
+
</ul>
|
175 |
+
</div>
|
176 |
+
<div class="apt_pro_buy_now">
|
177 |
+
<a href="http://codecanyon.net/item/auto-post-thumbnail-pro/4322624?ref=sanisoft" target=" _blank"><input type="button" value="Upgrade" class="button-primary"/></a>
|
178 |
+
</div>
|
179 |
+
</div>
|
180 |
+
<?php } ?>
|
181 |
+
</div>
|
182 |
</div>
|
183 |
<?php
|
184 |
} //End apt_interface()
|
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 |
+
|
207 |
wp_enqueue_style( 'jquery-ui-genpostthumbs', plugins_url( 'jquery-ui/redmond/jquery-ui-1.7.2.custom.css', __FILE__ ), array(), '1.7.2' );
|
208 |
} //End apt_admin_enqueues
|
209 |
|
css/style.css
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.apt_pro_advertisement{
|
2 |
+
float: right;
|
3 |
+
width: 230px;
|
4 |
+
margin-top: 15px;
|
5 |
+
margin-right:-240px;
|
6 |
+
border: medium none;
|
7 |
+
border-radius: 4px;
|
8 |
+
box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.3);
|
9 |
+
padding:5px 5px 15px 5px;
|
10 |
+
background: #fff;
|
11 |
+
}
|
12 |
+
|
13 |
+
.apt_pro_logo {
|
14 |
+
float:left;
|
15 |
+
box-shadow: 4px 4px 5px rgba(0, 0, 0, 0.3);
|
16 |
+
margin:10px;
|
17 |
+
border-radius:3px;
|
18 |
+
}
|
19 |
+
|
20 |
+
.apt_pro_logo img {
|
21 |
+
border-radius:3px;
|
22 |
+
}
|
23 |
+
|
24 |
+
.apt_pro_check_out {
|
25 |
+
float:left;
|
26 |
+
font-size:35px;
|
27 |
+
line-height:35px;
|
28 |
+
width:120px;
|
29 |
+
padding-top:10px;
|
30 |
+
text-align: center;
|
31 |
+
font-family:message-box;
|
32 |
+
color: #EEEEEE;
|
33 |
+
text-shadow: 1px 1px 2px #000000;
|
34 |
+
}
|
35 |
+
|
36 |
+
.apt_pro_features {
|
37 |
+
padding-left:10px;
|
38 |
+
clear:both;
|
39 |
+
}
|
40 |
+
|
41 |
+
.apt_pro_features ul {
|
42 |
+
list-style:disc inside;
|
43 |
+
}
|
44 |
+
|
45 |
+
.apt_pro_buy_now {
|
46 |
+
text-align: center;
|
47 |
+
}
|
img/apt_logo.jpg
ADDED
Binary file
|
readme.txt
CHANGED
@@ -2,14 +2,13 @@
|
|
2 |
Contributors: adityamooley
|
3 |
Tags: Post, thumbnail, automatic, posts, featured image, image, featured, images, admin
|
4 |
Requires at least: 2.9.1
|
5 |
-
Tested up to: 3.
|
6 |
-
Stable tag: 3.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 |
|
10 |
== Description ==
|
11 |
|
12 |
-
|
13 |
Go PRO! A premium version of the plugin has been launched with many more features - [See for details](http://codecanyon.net/item/auto-post-thumbnail-pro/4322624?ref=sanisoft)
|
14 |
|
15 |
Auto post thumbnail is a plugin to generate post thumbnail from first image in post or any custom post type. If the first image doesn't work it will automatically search for the next one and so on until the post thumbnail is inserted.
|
@@ -28,6 +27,10 @@ For more details, see http://www.sanisoft.com/blog/2010/04/19/wordpress-plugin-a
|
|
28 |
|
29 |
== Changelog ==
|
30 |
|
|
|
|
|
|
|
|
|
31 |
= 3.3.1 =
|
32 |
* Tested with WordPress-3.5.1
|
33 |
|
2 |
Contributors: adityamooley
|
3 |
Tags: Post, thumbnail, automatic, posts, featured image, image, featured, images, admin
|
4 |
Requires at least: 2.9.1
|
5 |
+
Tested up to: 3.6.x
|
6 |
+
Stable tag: 3.3.2
|
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 |
|
10 |
== Description ==
|
11 |
|
|
|
12 |
Go PRO! A premium version of the plugin has been launched with many more features - [See for details](http://codecanyon.net/item/auto-post-thumbnail-pro/4322624?ref=sanisoft)
|
13 |
|
14 |
Auto post thumbnail is a plugin to generate post thumbnail from first image in post or any custom post type. If the first image doesn't work it will automatically search for the next one and so on until the post thumbnail is inserted.
|
27 |
|
28 |
== Changelog ==
|
29 |
|
30 |
+
= 3.3.2 =
|
31 |
+
* Tested with WordPress-3.6.x
|
32 |
+
* Small tweaks
|
33 |
+
|
34 |
= 3.3.1 =
|
35 |
* Tested with WordPress-3.5.1
|
36 |
|