Version Description
- Adds crop mode option
- Add show published time option
- Now uses date / time format settings
- Bug fixes
Download this release
Release Info
Developer | bostondv |
Plugin | Ultimate Posts Widget |
Version | 1.5 |
Comparing to | |
See all releases |
Code changes from version 1.4.5 to 1.5
- .gitignore +1 -0
- readme.txt +14 -5
- screenshot-1.png +0 -0
- ultimate-posts-widget.php +212 -161
.gitignore
CHANGED
@@ -1 +1,2 @@
|
|
|
|
1 |
cache
|
1 |
+
.svn
|
2 |
cache
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: bostondv
|
|
3 |
Donate link: http://www.pomelodesign.com/donate
|
4 |
Tags: widget, recent posts, custom post types, sticky posts, featured image, post thumbnail, excerpts, category
|
5 |
Requires at least: 3.0
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag: 1.
|
8 |
License: GPL2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -23,6 +23,7 @@ Options:
|
|
23 |
* Select number of posts to display
|
24 |
* Display title
|
25 |
* Display publish date
|
|
|
26 |
* Display excerpt
|
27 |
* Display read more link
|
28 |
* Display featured image
|
@@ -30,9 +31,10 @@ Options:
|
|
30 |
* Custom read more link text
|
31 |
* Custom excerpt length (in words)
|
32 |
* Custom featured image size
|
|
|
33 |
* Order by date, title, number of comments or random
|
34 |
|
35 |
-
For support please use [
|
36 |
|
37 |
== Frequently Asked Questions ==
|
38 |
|
@@ -44,11 +46,18 @@ Nothing right now.
|
|
44 |
|
45 |
== Changelog ==
|
46 |
|
47 |
-
= 1.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
* Updates screenshot
|
50 |
|
51 |
-
= 1.4.4 =
|
52 |
|
53 |
* Fixes show_readmore function
|
54 |
* Adds more button link option
|
3 |
Donate link: http://www.pomelodesign.com/donate
|
4 |
Tags: widget, recent posts, custom post types, sticky posts, featured image, post thumbnail, excerpts, category
|
5 |
Requires at least: 3.0
|
6 |
+
Tested up to: 3.5.1
|
7 |
+
Stable tag: 1.5
|
8 |
License: GPL2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
23 |
* Select number of posts to display
|
24 |
* Display title
|
25 |
* Display publish date
|
26 |
+
* Display publish time
|
27 |
* Display excerpt
|
28 |
* Display read more link
|
29 |
* Display featured image
|
31 |
* Custom read more link text
|
32 |
* Custom excerpt length (in words)
|
33 |
* Custom featured image size
|
34 |
+
* Feature image crop mode
|
35 |
* Order by date, title, number of comments or random
|
36 |
|
37 |
+
For support please use [wordpress.org](http://wordpress.org/support/plugin/ultimate-posts-widget). Visit [our website](http://pomelodesign.com), follow [@pomelod](http://twitter.com/pomelod/) or like [on facebook](http://www.facebook.com/pomelodesign/) for updates.
|
38 |
|
39 |
== Frequently Asked Questions ==
|
40 |
|
46 |
|
47 |
== Changelog ==
|
48 |
|
49 |
+
= 1.5 =
|
50 |
+
|
51 |
+
* Adds crop mode option
|
52 |
+
* Add show published time option
|
53 |
+
* Now uses date / time format settings
|
54 |
+
* Bug fixes
|
55 |
+
|
56 |
+
= 1.4.5 =
|
57 |
|
58 |
* Updates screenshot
|
59 |
|
60 |
+
= 1.4.4 =
|
61 |
|
62 |
* Fixes show_readmore function
|
63 |
* Adds more button link option
|
screenshot-1.png
CHANGED
Binary file
|
ultimate-posts-widget.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Ultimate Posts Widget
|
4 |
Plugin URI: http://pomelodesign.com/ultimate-posts-widget
|
5 |
Description: The ultimate widget for displaying posts, custom post types or sticky posts with an array of options.
|
6 |
-
Version: 1.
|
7 |
Author: Pomelo Design
|
8 |
Author URI: http://pomelodesign.com
|
9 |
License: GPL2
|
@@ -24,24 +24,24 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
24 |
*/
|
25 |
|
26 |
if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
27 |
-
|
28 |
class WP_Widget_Ultimate_Posts extends WP_Widget {
|
29 |
-
|
30 |
function WP_Widget_Ultimate_Posts() {
|
31 |
-
|
32 |
-
$widget_ops = array( 'classname' => 'widget_ultimate_posts', 'description' => __( '
|
33 |
$this->WP_Widget( 'sticky-posts', __( 'Ultimate Posts' ), $widget_ops );
|
34 |
$this->alt_option_name = 'widget_ultimate_posts';
|
35 |
-
|
36 |
add_action( 'save_post', array( &$this, 'flush_widget_cache' ) );
|
37 |
add_action( 'deleted_post', array( &$this, 'flush_widget_cache' ) );
|
38 |
add_action( 'switch_theme', array( &$this, 'flush_widget_cache' ) );
|
39 |
-
|
40 |
}
|
41 |
-
|
42 |
function widget( $args, $instance ) {
|
43 |
|
44 |
-
if( !function_exists(get_image_path) ) {
|
45 |
function get_image_path($src) {
|
46 |
global $blog_id;
|
47 |
if(isset($blog_id) && $blog_id > 0) {
|
@@ -53,57 +53,52 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
53 |
return $src;
|
54 |
}
|
55 |
}
|
56 |
-
|
57 |
$cache = wp_cache_get( 'widget_ultimate_posts', 'widget' );
|
58 |
-
|
59 |
if ( !is_array( $cache ) )
|
60 |
$cache = array();
|
61 |
-
|
62 |
if ( isset( $cache[$args['widget_id']] ) ) {
|
63 |
echo $cache[$args['widget_id']];
|
64 |
return;
|
65 |
}
|
66 |
-
|
67 |
ob_start();
|
68 |
extract( $args );
|
69 |
-
|
70 |
$title = apply_filters( 'widget_title', $instance['title'] );
|
71 |
$number = $instance['number'];
|
72 |
-
$
|
73 |
-
|
74 |
-
$
|
75 |
-
if (!empty($categories)) $cats = explode(',', $categories);
|
76 |
-
$atcat = $instance['atcat'];
|
77 |
$thumb_w = $instance['thumb_w'];
|
78 |
$thumb_h = $instance['thumb_h'];
|
|
|
79 |
$excerpt_length = $instance['excerpt_length'];
|
80 |
$excerpt_readmore = $instance['excerpt_readmore'];
|
81 |
-
$sticky = $instance['sticky'];
|
82 |
$order = $instance['order'];
|
|
|
83 |
|
84 |
// If $atcat true and in category
|
85 |
-
if ($atcat && is_category()) {
|
86 |
-
$cats = get_query_var('cat');
|
87 |
}
|
88 |
|
89 |
// If $atcat true and is single post
|
90 |
-
if ($atcat && is_single()) {
|
91 |
-
$cats = '';
|
92 |
-
foreach (get_the_category() as $catt) {
|
93 |
-
$cats .= $catt->cat_ID.' ';
|
94 |
-
}
|
95 |
-
$cats = str_replace(" ", ",", trim($cats));
|
96 |
-
}
|
97 |
-
|
98 |
-
// If sticky
|
99 |
-
if ($sticky) {
|
100 |
-
$sticky_option = get_option( 'sticky_posts' );
|
101 |
}
|
102 |
|
103 |
//Excerpt more filter
|
104 |
-
$new_excerpt_more = create_function('$more', 'return "...";');
|
105 |
add_filter('excerpt_more', $new_excerpt_more);
|
106 |
-
|
107 |
// Excerpt length filter
|
108 |
$new_excerpt_length = create_function('$length', "return " . $excerpt_length . ";");
|
109 |
if ( $instance["excerpt_length"] > 0 ) add_filter('excerpt_length', $new_excerpt_length);
|
@@ -113,20 +108,25 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
113 |
|
114 |
$args = array(
|
115 |
'showposts' => $number,
|
116 |
-
'
|
117 |
-
'
|
|
|
118 |
'category__in' => $cats,
|
119 |
'post_type' => $types
|
120 |
);
|
121 |
|
122 |
$r = new WP_Query( $args );
|
123 |
-
|
124 |
if ( $r->have_posts() ) :
|
125 |
-
|
126 |
echo '<ul>';
|
127 |
-
|
128 |
-
while ( $r->have_posts() ) : $r->the_post();
|
129 |
-
|
|
|
|
|
|
|
|
|
130 |
<li>
|
131 |
|
132 |
<?php
|
@@ -140,22 +140,32 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
140 |
|
141 |
<div class="upw-image">
|
142 |
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
|
143 |
-
<img src="<?php echo WP_PLUGIN_URL . '/ultimate-posts-widget/thumb.php?src='. get_image_path($thumbnail[0]) .'&h='.$thumb_h.'&w='.$thumb_w.'
|
144 |
</a>
|
145 |
</div>
|
146 |
|
147 |
<?php endif; ?>
|
148 |
|
149 |
<div class="upw-content">
|
150 |
-
|
151 |
<?php if ( get_the_title() && $instance['show_title'] ) : ?>
|
152 |
<a class="post-title" href="<?php the_permalink(); ?>" title="<?php echo esc_attr( get_the_title() ? get_the_title() : get_the_ID() ); ?>">
|
153 |
<?php the_title(); ?>
|
154 |
</a>
|
155 |
<?php endif; ?>
|
156 |
|
157 |
-
<?php if ( $instance['show_date'] ) : ?>
|
158 |
-
<p class="post-date"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
<?php endif; ?>
|
160 |
|
161 |
<?php if ( $instance['show_excerpt'] ) :
|
@@ -166,35 +176,37 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
166 |
</div>
|
167 |
|
168 |
</li>
|
169 |
-
|
170 |
<?php
|
171 |
endwhile;
|
172 |
echo '</ul>';
|
173 |
-
|
174 |
if ( $instance['show_morebutton'] ) : ?>
|
175 |
<div class="upw-more">
|
176 |
<a href="<?php echo $instance['morebutton_url']; ?>" class="button"><?php echo $instance['morebutton_text']; ?></a>
|
177 |
</div>
|
178 |
<?php endif;
|
179 |
-
|
180 |
// Reset the global $the_post as this query will have stomped on it
|
181 |
wp_reset_postdata();
|
182 |
|
183 |
else :
|
184 |
|
185 |
echo __('No posts found.');
|
186 |
-
|
187 |
endif;
|
188 |
|
189 |
echo $after_widget;
|
190 |
-
|
191 |
-
$cache
|
|
|
|
|
192 |
wp_cache_set( 'widget_ultimate_posts', $cache, 'widget' );
|
193 |
}
|
194 |
-
|
195 |
function update( $new_instance, $old_instance ) {
|
196 |
$instance = $old_instance;
|
197 |
-
|
198 |
//Let's turn that array into something the Wordpress database can store
|
199 |
$types = implode(',', (array)$new_instance['types']);
|
200 |
$cats = implode(',', (array)$new_instance['cats']);
|
@@ -203,39 +215,42 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
203 |
$instance['number'] = strip_tags( $new_instance['number'] );
|
204 |
$instance['types'] = $types;
|
205 |
$instance['cats'] = $cats;
|
206 |
-
$instance['atcat'] =
|
207 |
-
$instance['show_excerpt'] =
|
208 |
-
$instance['show_thumbnail'] =
|
209 |
-
$instance['show_date'] =
|
210 |
-
$instance['
|
|
|
211 |
$instance['thumb_w'] = strip_tags( $new_instance['thumb_w'] );
|
212 |
$instance['thumb_h'] = strip_tags( $new_instance['thumb_h'] );
|
213 |
-
$instance['
|
|
|
214 |
$instance['excerpt_length'] = strip_tags( $new_instance['excerpt_length'] );
|
215 |
$instance['excerpt_readmore'] = strip_tags( $new_instance['excerpt_readmore'] );
|
216 |
-
$instance['sticky'] =
|
217 |
-
$instance['order'] =
|
218 |
-
$instance['
|
|
|
219 |
$instance['morebutton_url'] = strip_tags( $new_instance['morebutton_url'] );
|
220 |
$instance['morebutton_text'] = strip_tags( $new_instance['morebutton_text'] );
|
221 |
-
|
222 |
-
|
223 |
$this->flush_widget_cache();
|
224 |
-
|
225 |
$alloptions = wp_cache_get( 'alloptions', 'options' );
|
226 |
if ( isset( $alloptions['widget_ultimate_posts'] ) )
|
227 |
delete_option( 'widget_ultimate_posts' );
|
228 |
-
|
229 |
return $instance;
|
230 |
-
|
231 |
}
|
232 |
-
|
233 |
function flush_widget_cache() {
|
234 |
-
|
235 |
wp_cache_delete( 'widget_ultimate_posts', 'widget' );
|
236 |
-
|
237 |
}
|
238 |
-
|
239 |
function form( $instance ) {
|
240 |
|
241 |
// instance exist? if not set defaults
|
@@ -246,9 +261,11 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
246 |
$cats = $instance['cats'];
|
247 |
$thumb_w = $instance['thumb_w'];
|
248 |
$thumb_h = $instance['thumb_h'];
|
|
|
249 |
$excerpt_length = $instance['excerpt_length'];
|
250 |
$excerpt_readmore = $instance['excerpt_readmore'];
|
251 |
$order = $instance['order'];
|
|
|
252 |
$morebutton_text = $instance['morebutton_text'];
|
253 |
$morebutton_url = $instance['morebutton_url'];
|
254 |
} else {
|
@@ -259,9 +276,11 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
259 |
$cats = '';
|
260 |
$thumb_w = 100;
|
261 |
$thumb_h = 100;
|
|
|
262 |
$excerpt_length = 10;
|
263 |
$excerpt_readmore = 'Read more →';
|
264 |
-
$order = '
|
|
|
265 |
$morebutton_text = 'View More Posts';
|
266 |
$morebutton_url = get_bloginfo('url');
|
267 |
}
|
@@ -269,7 +288,7 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
269 |
//Let's turn $types and $cats into an array
|
270 |
$types = explode(',', $types);
|
271 |
$cats = explode(',', $cats);
|
272 |
-
|
273 |
//Count number of post types for select box sizing
|
274 |
$cpt_types = get_post_types( array( 'public' => true ), 'names' );
|
275 |
foreach ($cpt_types as $cpt ) {
|
@@ -290,7 +309,7 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
290 |
|
291 |
<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
|
292 |
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
293 |
-
|
294 |
<p><label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of posts:' ); ?></label>
|
295 |
<input id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" type="text" value="<?php echo $number; ?>" size="2" /></p>
|
296 |
|
@@ -301,7 +320,12 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
301 |
|
302 |
<p>
|
303 |
<input class="checkbox" id="<?php echo $this->get_field_id( 'show_date' ); ?>" name="<?php echo $this->get_field_name( 'show_date' ); ?>" type="checkbox" <?php checked( (bool) $instance["show_date"], true ); ?> />
|
304 |
-
<label for="<?php echo $this->get_field_id( 'show_date' ); ?>"><?php _e( 'Show date' ); ?></label>
|
|
|
|
|
|
|
|
|
|
|
305 |
</p>
|
306 |
|
307 |
<p>
|
@@ -320,8 +344,8 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
320 |
<?php _e( 'Show read more link' ); ?>
|
321 |
</label>
|
322 |
</p>
|
323 |
-
|
324 |
-
<p
|
325 |
<label for="<?php echo $this->get_field_id('excerpt_readmore'); ?>"><?php _e( 'Read more text:' ); ?></label>
|
326 |
<input class="widefat" type="text" id="<?php echo $this->get_field_id('excerpt_readmore'); ?>" name="<?php echo $this->get_field_name("excerpt_readmore"); ?>" value="<?php echo $excerpt_readmore; ?>" />
|
327 |
</p>
|
@@ -344,6 +368,17 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
344 |
</label>
|
345 |
</p>
|
346 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
347 |
<?php endif; ?>
|
348 |
|
349 |
<p>
|
@@ -351,12 +386,12 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
351 |
<label for="<?php echo $this->get_field_id('show_morebutton'); ?>"> <?php _e('Show more button'); ?></label>
|
352 |
</p>
|
353 |
|
354 |
-
<p
|
355 |
<label for="<?php echo $this->get_field_id('morebutton_text'); ?>"><?php _e( 'More button text:' ); ?></label>
|
356 |
<input class="widefat" type="text" id="<?php echo $this->get_field_id('morebutton_text'); ?>" name="<?php echo $this->get_field_name('morebutton_text'); ?>" value="<?php echo $morebutton_text; ?>" />
|
357 |
</p>
|
358 |
|
359 |
-
<p
|
360 |
<label for="<?php echo $this->get_field_id('morebutton_url'); ?>"><?php _e( 'More button URL:' ); ?></label>
|
361 |
<input class="widefat" type="text" id="<?php echo $this->get_field_id('morebutton_url'); ?>" name="<?php echo $this->get_field_name('morebutton_url'); ?>" value="<?php echo $morebutton_url; ?>" />
|
362 |
</p>
|
@@ -374,7 +409,7 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
374 |
<p>
|
375 |
<label for="<?php echo $this->get_field_id('cats'); ?>"><?php _e( 'Select categories:' ); ?></label>
|
376 |
<select name="<?php echo $this->get_field_name('cats'); ?>[]" id="<?php echo $this->get_field_id('cats'); ?>" class="widefat" style="height: auto;" size="<?php echo $c ?>" multiple>
|
377 |
-
<?php
|
378 |
$categories = get_categories( 'hide_empty=0' );
|
379 |
foreach ($categories as $category ) { ?>
|
380 |
<option value="<?php echo $category->term_id; ?>" <?php if( in_array($category->term_id, $cats)) { echo 'selected="selected"'; } ?>><?php echo $category->cat_name;?></option>
|
@@ -385,7 +420,7 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
385 |
<p>
|
386 |
<label for="<?php echo $this->get_field_id('types'); ?>"><?php _e( 'Select post type(s):' ); ?></label>
|
387 |
<select name="<?php echo $this->get_field_name('types'); ?>[]" id="<?php echo $this->get_field_id('types'); ?>" class="widefat" style="height: auto;" size="<?php echo $n ?>" multiple>
|
388 |
-
<?php
|
389 |
$args = array( 'public' => true );
|
390 |
$post_types = get_post_types( $args, 'names' );
|
391 |
foreach ($post_types as $post_type ) { ?>
|
@@ -395,111 +430,127 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
395 |
</p>
|
396 |
|
397 |
<p>
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
405 |
</p>
|
406 |
|
407 |
<p class="credits"><small>Developed by <a href="http://pomelodesign.com">Pomelo Design</a></small></p>
|
408 |
|
409 |
-
|
410 |
-
|
411 |
-
jQuery(document).ready(function($){
|
412 |
-
|
413 |
-
var show_excerpt = $("#<?php echo $this->get_field_id( 'show_excerpt' ); ?>");
|
414 |
-
var show_readmore = $("#<?php echo $this->get_field_id( 'show_readmore' ); ?>");
|
415 |
-
var show_thumbnail = $("#<?php echo $this->get_field_id( 'show_thumbnail' ); ?>");
|
416 |
-
var excerpt_length = $("#<?php echo $this->get_field_id( 'excerpt_length' ); ?>").parents('p');
|
417 |
-
var excerpt_readmore = $("#<?php echo $this->get_field_id( 'excerpt_readmore' ); ?>").parents('p');
|
418 |
-
var thumb_w = $("#<?php echo $this->get_field_id( 'thumb_w' ); ?>").parents('p');
|
419 |
-
var show_morebutton = $("#<?php echo $this->get_field_id( 'show_morebutton' ); ?>");
|
420 |
-
var morebutton_text = $("#<?php echo $this->get_field_id( 'morebutton_text' ); ?>").parents('p');
|
421 |
-
var morebutton_url = $("#<?php echo $this->get_field_id( 'morebutton_url' ); ?>").parents('p');
|
422 |
-
|
423 |
-
<?php
|
424 |
-
// Use PHP to determine if not checked and hide if so
|
425 |
-
// jQuery method was acting up
|
426 |
-
if ( !$instance['show_excerpt'] ) {
|
427 |
-
echo 'excerpt_length.hide();';
|
428 |
-
}
|
429 |
-
if ( !$instance['show_readmore'] ) {
|
430 |
-
echo 'excerpt_readmore.hide();';
|
431 |
-
}
|
432 |
-
if ( !$instance['show_thumbnail'] ) {
|
433 |
-
echo 'thumb_w.hide();';
|
434 |
-
}
|
435 |
-
if ( !$instance['show_morebutton'] ) {
|
436 |
-
echo 'morebutton_text.hide();';
|
437 |
-
echo 'morebutton_url.hide();';
|
438 |
-
}
|
439 |
-
?>
|
440 |
|
441 |
-
|
442 |
-
show_excerpt.click(function(){
|
443 |
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
448 |
}
|
|
|
|
|
|
|
|
|
|
|
449 |
|
450 |
-
|
|
|
451 |
|
452 |
-
|
453 |
-
|
|
|
|
|
|
|
454 |
|
455 |
-
|
456 |
-
excerpt_readmore.show("fast");
|
457 |
-
} else {
|
458 |
-
excerpt_readmore.hide("fast");
|
459 |
-
}
|
460 |
|
461 |
-
|
|
|
462 |
|
463 |
-
|
464 |
-
|
|
|
|
|
|
|
465 |
|
466 |
-
|
467 |
-
thumb_w.show("fast");
|
468 |
-
} else {
|
469 |
-
thumb_w.hide("fast");
|
470 |
-
}
|
471 |
|
472 |
-
|
|
|
473 |
|
474 |
-
|
475 |
-
|
|
|
|
|
|
|
|
|
|
|
476 |
|
477 |
-
|
478 |
-
morebutton_text.show("fast");
|
479 |
-
morebutton_url.show("fast");
|
480 |
-
} else {
|
481 |
-
morebutton_text.hide("fast");
|
482 |
-
morebutton_url.hide("fast");
|
483 |
-
}
|
484 |
|
485 |
-
|
|
|
486 |
|
487 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
488 |
|
489 |
-
|
|
|
|
|
|
|
|
|
490 |
|
491 |
<?php
|
492 |
-
|
|
|
|
|
493 |
}
|
494 |
-
|
495 |
}
|
496 |
-
|
497 |
function init_WP_Widget_Ultimate_Posts() {
|
498 |
-
|
499 |
register_widget( 'WP_Widget_Ultimate_Posts' );
|
500 |
-
|
501 |
}
|
502 |
-
|
503 |
add_action( 'widgets_init', 'init_WP_Widget_Ultimate_Posts' );
|
504 |
|
505 |
}
|
3 |
Plugin Name: Ultimate Posts Widget
|
4 |
Plugin URI: http://pomelodesign.com/ultimate-posts-widget
|
5 |
Description: The ultimate widget for displaying posts, custom post types or sticky posts with an array of options.
|
6 |
+
Version: 1.5
|
7 |
Author: Pomelo Design
|
8 |
Author URI: http://pomelodesign.com
|
9 |
License: GPL2
|
24 |
*/
|
25 |
|
26 |
if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
27 |
+
|
28 |
class WP_Widget_Ultimate_Posts extends WP_Widget {
|
29 |
+
|
30 |
function WP_Widget_Ultimate_Posts() {
|
31 |
+
|
32 |
+
$widget_ops = array( 'classname' => 'widget_ultimate_posts', 'description' => __( 'Displays posts, custom post types or sticky posts with an array of options' ) );
|
33 |
$this->WP_Widget( 'sticky-posts', __( 'Ultimate Posts' ), $widget_ops );
|
34 |
$this->alt_option_name = 'widget_ultimate_posts';
|
35 |
+
|
36 |
add_action( 'save_post', array( &$this, 'flush_widget_cache' ) );
|
37 |
add_action( 'deleted_post', array( &$this, 'flush_widget_cache' ) );
|
38 |
add_action( 'switch_theme', array( &$this, 'flush_widget_cache' ) );
|
39 |
+
|
40 |
}
|
41 |
+
|
42 |
function widget( $args, $instance ) {
|
43 |
|
44 |
+
if( !function_exists('get_image_path') ) {
|
45 |
function get_image_path($src) {
|
46 |
global $blog_id;
|
47 |
if(isset($blog_id) && $blog_id > 0) {
|
53 |
return $src;
|
54 |
}
|
55 |
}
|
56 |
+
|
57 |
$cache = wp_cache_get( 'widget_ultimate_posts', 'widget' );
|
58 |
+
|
59 |
if ( !is_array( $cache ) )
|
60 |
$cache = array();
|
61 |
+
|
62 |
if ( isset( $cache[$args['widget_id']] ) ) {
|
63 |
echo $cache[$args['widget_id']];
|
64 |
return;
|
65 |
}
|
66 |
+
|
67 |
ob_start();
|
68 |
extract( $args );
|
69 |
+
|
70 |
$title = apply_filters( 'widget_title', $instance['title'] );
|
71 |
$number = $instance['number'];
|
72 |
+
$types = ($instance['types'] ? explode(',', $instance['types']) : '');
|
73 |
+
$cats = ($instance['cats'] ? explode(',', $instance['cats']) : '');
|
74 |
+
$atcat = $instance['atcat'] ? true : false;
|
|
|
|
|
75 |
$thumb_w = $instance['thumb_w'];
|
76 |
$thumb_h = $instance['thumb_h'];
|
77 |
+
$thumb_crop = $instance['thumb_crop'];
|
78 |
$excerpt_length = $instance['excerpt_length'];
|
79 |
$excerpt_readmore = $instance['excerpt_readmore'];
|
80 |
+
$sticky = ($instance['sticky'] ? get_option( 'sticky_posts' ) : false);
|
81 |
$order = $instance['order'];
|
82 |
+
$orderby = $instance['orderby'];
|
83 |
|
84 |
// If $atcat true and in category
|
85 |
+
if ($atcat && is_category()) {
|
86 |
+
$cats = get_query_var('cat');
|
87 |
}
|
88 |
|
89 |
// If $atcat true and is single post
|
90 |
+
if ($atcat && is_single()) {
|
91 |
+
$cats = '';
|
92 |
+
foreach (get_the_category() as $catt) {
|
93 |
+
$cats .= $catt->cat_ID.' ';
|
94 |
+
}
|
95 |
+
$cats = str_replace(" ", ",", trim($cats));
|
|
|
|
|
|
|
|
|
|
|
96 |
}
|
97 |
|
98 |
//Excerpt more filter
|
99 |
+
$new_excerpt_more = create_function('$more', 'return "...";');
|
100 |
add_filter('excerpt_more', $new_excerpt_more);
|
101 |
+
|
102 |
// Excerpt length filter
|
103 |
$new_excerpt_length = create_function('$length', "return " . $excerpt_length . ";");
|
104 |
if ( $instance["excerpt_length"] > 0 ) add_filter('excerpt_length', $new_excerpt_length);
|
108 |
|
109 |
$args = array(
|
110 |
'showposts' => $number,
|
111 |
+
'order' => $order,
|
112 |
+
'orderby' => $orderby,
|
113 |
+
'post__in' => $sticky,
|
114 |
'category__in' => $cats,
|
115 |
'post_type' => $types
|
116 |
);
|
117 |
|
118 |
$r = new WP_Query( $args );
|
119 |
+
|
120 |
if ( $r->have_posts() ) :
|
121 |
+
|
122 |
echo '<ul>';
|
123 |
+
|
124 |
+
while ( $r->have_posts() ) : $r->the_post();
|
125 |
+
|
126 |
+
global $post;
|
127 |
+
|
128 |
+
?>
|
129 |
+
|
130 |
<li>
|
131 |
|
132 |
<?php
|
140 |
|
141 |
<div class="upw-image">
|
142 |
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
|
143 |
+
<img src="<?php echo WP_PLUGIN_URL . '/ultimate-posts-widget/thumb.php?src='. get_image_path($thumbnail[0]) .'&h='.$thumb_h.'&w='.$thumb_w.'&zc='.$thumb_crop; ?>" alt="<?php the_title_attribute(); ?>" />
|
144 |
</a>
|
145 |
</div>
|
146 |
|
147 |
<?php endif; ?>
|
148 |
|
149 |
<div class="upw-content">
|
150 |
+
|
151 |
<?php if ( get_the_title() && $instance['show_title'] ) : ?>
|
152 |
<a class="post-title" href="<?php the_permalink(); ?>" title="<?php echo esc_attr( get_the_title() ? get_the_title() : get_the_ID() ); ?>">
|
153 |
<?php the_title(); ?>
|
154 |
</a>
|
155 |
<?php endif; ?>
|
156 |
|
157 |
+
<?php if ( $instance['show_date'] || $instance['show_time'] ) : ?>
|
158 |
+
<p class="post-date">
|
159 |
+
<?php
|
160 |
+
if ( $instance['show_date'] && $instance['show_time'] ) {
|
161 |
+
the_time(get_option('date_format') . ' ' . get_option('time_format'));
|
162 |
+
} elseif ( $instance['show_date'] && !$instance['show_time'] ) {
|
163 |
+
the_time(get_option('date_format'));
|
164 |
+
} else {
|
165 |
+
the_time(get_option('time_format'));
|
166 |
+
}
|
167 |
+
?>
|
168 |
+
</p>
|
169 |
<?php endif; ?>
|
170 |
|
171 |
<?php if ( $instance['show_excerpt'] ) :
|
176 |
</div>
|
177 |
|
178 |
</li>
|
179 |
+
|
180 |
<?php
|
181 |
endwhile;
|
182 |
echo '</ul>';
|
183 |
+
|
184 |
if ( $instance['show_morebutton'] ) : ?>
|
185 |
<div class="upw-more">
|
186 |
<a href="<?php echo $instance['morebutton_url']; ?>" class="button"><?php echo $instance['morebutton_text']; ?></a>
|
187 |
</div>
|
188 |
<?php endif;
|
189 |
+
|
190 |
// Reset the global $the_post as this query will have stomped on it
|
191 |
wp_reset_postdata();
|
192 |
|
193 |
else :
|
194 |
|
195 |
echo __('No posts found.');
|
196 |
+
|
197 |
endif;
|
198 |
|
199 |
echo $after_widget;
|
200 |
+
|
201 |
+
if ($cache) {
|
202 |
+
$cache[$args['widget_id']] = ob_get_flush();
|
203 |
+
}
|
204 |
wp_cache_set( 'widget_ultimate_posts', $cache, 'widget' );
|
205 |
}
|
206 |
+
|
207 |
function update( $new_instance, $old_instance ) {
|
208 |
$instance = $old_instance;
|
209 |
+
|
210 |
//Let's turn that array into something the Wordpress database can store
|
211 |
$types = implode(',', (array)$new_instance['types']);
|
212 |
$cats = implode(',', (array)$new_instance['cats']);
|
215 |
$instance['number'] = strip_tags( $new_instance['number'] );
|
216 |
$instance['types'] = $types;
|
217 |
$instance['cats'] = $cats;
|
218 |
+
$instance['atcat'] = $new_instance['atcat'];
|
219 |
+
$instance['show_excerpt'] = $new_instance['show_excerpt'];
|
220 |
+
$instance['show_thumbnail'] = $new_instance['show_thumbnail'];
|
221 |
+
$instance['show_date'] = $new_instance['show_date'];
|
222 |
+
$instance['show_time'] = $new_instance['show_time'];
|
223 |
+
$instance['show_title'] = $new_instance['show_title'];
|
224 |
$instance['thumb_w'] = strip_tags( $new_instance['thumb_w'] );
|
225 |
$instance['thumb_h'] = strip_tags( $new_instance['thumb_h'] );
|
226 |
+
$instance['thumb_crop'] = $new_instance['thumb_crop'];
|
227 |
+
$instance['show_readmore'] = $new_instance['show_readmore'];
|
228 |
$instance['excerpt_length'] = strip_tags( $new_instance['excerpt_length'] );
|
229 |
$instance['excerpt_readmore'] = strip_tags( $new_instance['excerpt_readmore'] );
|
230 |
+
$instance['sticky'] = $new_instance['sticky'];
|
231 |
+
$instance['order'] = $new_instance['order'];
|
232 |
+
$instance['orderby'] = $new_instance['orderby'];
|
233 |
+
$instance['show_morebutton'] = $new_instance['show_morebutton'];
|
234 |
$instance['morebutton_url'] = strip_tags( $new_instance['morebutton_url'] );
|
235 |
$instance['morebutton_text'] = strip_tags( $new_instance['morebutton_text'] );
|
236 |
+
|
237 |
+
|
238 |
$this->flush_widget_cache();
|
239 |
+
|
240 |
$alloptions = wp_cache_get( 'alloptions', 'options' );
|
241 |
if ( isset( $alloptions['widget_ultimate_posts'] ) )
|
242 |
delete_option( 'widget_ultimate_posts' );
|
243 |
+
|
244 |
return $instance;
|
245 |
+
|
246 |
}
|
247 |
+
|
248 |
function flush_widget_cache() {
|
249 |
+
|
250 |
wp_cache_delete( 'widget_ultimate_posts', 'widget' );
|
251 |
+
|
252 |
}
|
253 |
+
|
254 |
function form( $instance ) {
|
255 |
|
256 |
// instance exist? if not set defaults
|
261 |
$cats = $instance['cats'];
|
262 |
$thumb_w = $instance['thumb_w'];
|
263 |
$thumb_h = $instance['thumb_h'];
|
264 |
+
$thumb_crop = $instance['thumb_crop'];
|
265 |
$excerpt_length = $instance['excerpt_length'];
|
266 |
$excerpt_readmore = $instance['excerpt_readmore'];
|
267 |
$order = $instance['order'];
|
268 |
+
$orderby = $instance['orderby'];
|
269 |
$morebutton_text = $instance['morebutton_text'];
|
270 |
$morebutton_url = $instance['morebutton_url'];
|
271 |
} else {
|
276 |
$cats = '';
|
277 |
$thumb_w = 100;
|
278 |
$thumb_h = 100;
|
279 |
+
$thumb_crop = 1;
|
280 |
$excerpt_length = 10;
|
281 |
$excerpt_readmore = 'Read more →';
|
282 |
+
$order = 'DESC';
|
283 |
+
$orderby = 'date';
|
284 |
$morebutton_text = 'View More Posts';
|
285 |
$morebutton_url = get_bloginfo('url');
|
286 |
}
|
288 |
//Let's turn $types and $cats into an array
|
289 |
$types = explode(',', $types);
|
290 |
$cats = explode(',', $cats);
|
291 |
+
|
292 |
//Count number of post types for select box sizing
|
293 |
$cpt_types = get_post_types( array( 'public' => true ), 'names' );
|
294 |
foreach ($cpt_types as $cpt ) {
|
309 |
|
310 |
<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
|
311 |
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
|
312 |
+
|
313 |
<p><label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of posts:' ); ?></label>
|
314 |
<input id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" type="text" value="<?php echo $number; ?>" size="2" /></p>
|
315 |
|
320 |
|
321 |
<p>
|
322 |
<input class="checkbox" id="<?php echo $this->get_field_id( 'show_date' ); ?>" name="<?php echo $this->get_field_name( 'show_date' ); ?>" type="checkbox" <?php checked( (bool) $instance["show_date"], true ); ?> />
|
323 |
+
<label for="<?php echo $this->get_field_id( 'show_date' ); ?>"><?php _e( 'Show published date' ); ?></label>
|
324 |
+
</p>
|
325 |
+
|
326 |
+
<p>
|
327 |
+
<input class="checkbox" id="<?php echo $this->get_field_id( 'show_time' ); ?>" name="<?php echo $this->get_field_name( 'show_time' ); ?>" type="checkbox" <?php checked( (bool) $instance["show_time"], true ); ?> />
|
328 |
+
<label for="<?php echo $this->get_field_id( 'show_time' ); ?>"><?php _e( 'Show published time' ); ?></label>
|
329 |
</p>
|
330 |
|
331 |
<p>
|
344 |
<?php _e( 'Show read more link' ); ?>
|
345 |
</label>
|
346 |
</p>
|
347 |
+
|
348 |
+
<p>
|
349 |
<label for="<?php echo $this->get_field_id('excerpt_readmore'); ?>"><?php _e( 'Read more text:' ); ?></label>
|
350 |
<input class="widefat" type="text" id="<?php echo $this->get_field_id('excerpt_readmore'); ?>" name="<?php echo $this->get_field_name("excerpt_readmore"); ?>" value="<?php echo $excerpt_readmore; ?>" />
|
351 |
</p>
|
368 |
</label>
|
369 |
</p>
|
370 |
|
371 |
+
<p>
|
372 |
+
<label><?php _e('Crop mode:'); ?></label>
|
373 |
+
<br />
|
374 |
+
<select id="<?php echo $this->get_field_id('thumb_crop'); ?>" name="<?php echo $this->get_field_name('thumb_crop'); ?>">
|
375 |
+
<option value="1"<?php if($thumb_crop == 1) echo ' selected'; ?>><?php _e('Scale & Crop to Fit'); ?></option>
|
376 |
+
<option value="0"<?php if($thumb_crop == 0) echo ' selected'; ?>><?php _e('Stretch to Fit'); ?></option>
|
377 |
+
<option value="2"<?php if($thumb_crop == 2) echo ' selected'; ?>><?php _e('Proportional Scale'); ?></option>
|
378 |
+
<option value="3"<?php if($thumb_crop == 3) echo ' selected'; ?>><?php _e('Proportional Scale No Borders'); ?></option>
|
379 |
+
</select>
|
380 |
+
</p>
|
381 |
+
|
382 |
<?php endif; ?>
|
383 |
|
384 |
<p>
|
386 |
<label for="<?php echo $this->get_field_id('show_morebutton'); ?>"> <?php _e('Show more button'); ?></label>
|
387 |
</p>
|
388 |
|
389 |
+
<p>
|
390 |
<label for="<?php echo $this->get_field_id('morebutton_text'); ?>"><?php _e( 'More button text:' ); ?></label>
|
391 |
<input class="widefat" type="text" id="<?php echo $this->get_field_id('morebutton_text'); ?>" name="<?php echo $this->get_field_name('morebutton_text'); ?>" value="<?php echo $morebutton_text; ?>" />
|
392 |
</p>
|
393 |
|
394 |
+
<p>
|
395 |
<label for="<?php echo $this->get_field_id('morebutton_url'); ?>"><?php _e( 'More button URL:' ); ?></label>
|
396 |
<input class="widefat" type="text" id="<?php echo $this->get_field_id('morebutton_url'); ?>" name="<?php echo $this->get_field_name('morebutton_url'); ?>" value="<?php echo $morebutton_url; ?>" />
|
397 |
</p>
|
409 |
<p>
|
410 |
<label for="<?php echo $this->get_field_id('cats'); ?>"><?php _e( 'Select categories:' ); ?></label>
|
411 |
<select name="<?php echo $this->get_field_name('cats'); ?>[]" id="<?php echo $this->get_field_id('cats'); ?>" class="widefat" style="height: auto;" size="<?php echo $c ?>" multiple>
|
412 |
+
<?php
|
413 |
$categories = get_categories( 'hide_empty=0' );
|
414 |
foreach ($categories as $category ) { ?>
|
415 |
<option value="<?php echo $category->term_id; ?>" <?php if( in_array($category->term_id, $cats)) { echo 'selected="selected"'; } ?>><?php echo $category->cat_name;?></option>
|
420 |
<p>
|
421 |
<label for="<?php echo $this->get_field_id('types'); ?>"><?php _e( 'Select post type(s):' ); ?></label>
|
422 |
<select name="<?php echo $this->get_field_name('types'); ?>[]" id="<?php echo $this->get_field_id('types'); ?>" class="widefat" style="height: auto;" size="<?php echo $n ?>" multiple>
|
423 |
+
<?php
|
424 |
$args = array( 'public' => true );
|
425 |
$post_types = get_post_types( $args, 'names' );
|
426 |
foreach ($post_types as $post_type ) { ?>
|
430 |
</p>
|
431 |
|
432 |
<p>
|
433 |
+
<label for="<?php echo $this->get_field_id('orderby'); ?>"><?php _e( 'Order by:' ); ?></label>
|
434 |
+
<select name="<?php echo $this->get_field_name('orderby'); ?>" id="<?php echo $this->get_field_id('orderby'); ?>" class="widefat">
|
435 |
+
<option value="date"<?php if( $orderby == 'date') echo ' selected'; ?>><?php _e('Published Date'); ?></option>
|
436 |
+
<option value="title"<?php if( $orderby == 'title') echo ' selected'; ?>><?php _e('Title'); ?></option>
|
437 |
+
<option value="comment_count"<?php if( $orderby == 'comment_count') echo ' selected'; ?>><?php _e('Comment Count'); ?></option>
|
438 |
+
<option value="rand"<?php if( $orderby == 'rand') echo ' selected'; ?>><?php _e('Random'); ?></option>
|
439 |
+
</select>
|
440 |
+
</p>
|
441 |
+
|
442 |
+
<p>
|
443 |
+
<label for="<?php echo $this->get_field_id('order'); ?>"><?php _e( 'Order:' ); ?></label>
|
444 |
+
<select name="<?php echo $this->get_field_name('order'); ?>" id="<?php echo $this->get_field_id('order'); ?>" class="widefat">
|
445 |
+
<option value="DESC"<?php if( $order == 'DESC') echo ' selected'; ?>><?php _e('Descending'); ?></option>
|
446 |
+
<option value="ASC"<?php if( $order == 'ASC') echo ' selected'; ?>><?php _e('Ascending'); ?></option>
|
447 |
+
</select>
|
448 |
</p>
|
449 |
|
450 |
<p class="credits"><small>Developed by <a href="http://pomelodesign.com">Pomelo Design</a></small></p>
|
451 |
|
452 |
+
<?php if ( $instance ) { ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
453 |
|
454 |
+
<script>
|
|
|
455 |
|
456 |
+
jQuery(document).ready(function($){
|
457 |
+
|
458 |
+
var show_excerpt = $("#<?php echo $this->get_field_id( 'show_excerpt' ); ?>");
|
459 |
+
var show_readmore = $("#<?php echo $this->get_field_id( 'show_readmore' ); ?>");
|
460 |
+
var show_thumbnail = $("#<?php echo $this->get_field_id( 'show_thumbnail' ); ?>");
|
461 |
+
var excerpt_length = $("#<?php echo $this->get_field_id( 'excerpt_length' ); ?>").parents('p');
|
462 |
+
var excerpt_readmore = $("#<?php echo $this->get_field_id( 'excerpt_readmore' ); ?>").parents('p');
|
463 |
+
var thumb_w = $("#<?php echo $this->get_field_id( 'thumb_w' ); ?>").parents('p');
|
464 |
+
var thumb_crop = $("#<?php echo $this->get_field_id( 'thumb_crop' ); ?>").parents('p');
|
465 |
+
var show_morebutton = $("#<?php echo $this->get_field_id( 'show_morebutton' ); ?>");
|
466 |
+
var morebutton_text = $("#<?php echo $this->get_field_id( 'morebutton_text' ); ?>").parents('p');
|
467 |
+
var morebutton_url = $("#<?php echo $this->get_field_id( 'morebutton_url' ); ?>").parents('p');
|
468 |
+
|
469 |
+
<?php
|
470 |
+
// Use PHP to determine if not checked and hide if so
|
471 |
+
// jQuery method was acting up
|
472 |
+
if ( !$instance['show_excerpt'] ) {
|
473 |
+
echo 'excerpt_length.hide();';
|
474 |
+
}
|
475 |
+
if ( !$instance['show_readmore'] ) {
|
476 |
+
echo 'excerpt_readmore.hide();';
|
477 |
+
}
|
478 |
+
if ( !$instance['show_thumbnail'] ) {
|
479 |
+
echo 'thumb_w.hide();';
|
480 |
+
echo 'thumb_crop.hide();';
|
481 |
}
|
482 |
+
if ( !$instance['show_morebutton'] ) {
|
483 |
+
echo 'morebutton_text.hide();';
|
484 |
+
echo 'morebutton_url.hide();';
|
485 |
+
}
|
486 |
+
?>
|
487 |
|
488 |
+
// Toggle excerpt length on click
|
489 |
+
show_excerpt.click(function(){
|
490 |
|
491 |
+
if ( $(this).is(":checked") ) {
|
492 |
+
excerpt_length.show("fast");
|
493 |
+
} else {
|
494 |
+
excerpt_length.hide("fast");
|
495 |
+
}
|
496 |
|
497 |
+
});
|
|
|
|
|
|
|
|
|
498 |
|
499 |
+
// Toggle excerpt length on click
|
500 |
+
show_readmore.click(function(){
|
501 |
|
502 |
+
if ( $(this).is(":checked") ) {
|
503 |
+
excerpt_readmore.show("fast");
|
504 |
+
} else {
|
505 |
+
excerpt_readmore.hide("fast");
|
506 |
+
}
|
507 |
|
508 |
+
});
|
|
|
|
|
|
|
|
|
509 |
|
510 |
+
// Toggle excerpt length on click
|
511 |
+
show_thumbnail.click(function(){
|
512 |
|
513 |
+
if ( $(this).is(":checked") ) {
|
514 |
+
thumb_w.show("fast");
|
515 |
+
thumb_crop.show("fast");
|
516 |
+
} else {
|
517 |
+
thumb_w.hide("fast");
|
518 |
+
thumb_crop.hide("fast");
|
519 |
+
}
|
520 |
|
521 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
522 |
|
523 |
+
// Toggle more button on click
|
524 |
+
show_morebutton.click(function(){
|
525 |
|
526 |
+
if ( $(this).is(":checked") ) {
|
527 |
+
morebutton_text.show("fast");
|
528 |
+
morebutton_url.show("fast");
|
529 |
+
} else {
|
530 |
+
morebutton_text.hide("fast");
|
531 |
+
morebutton_url.hide("fast");
|
532 |
+
}
|
533 |
|
534 |
+
});
|
535 |
+
|
536 |
+
});
|
537 |
+
|
538 |
+
</script>
|
539 |
|
540 |
<?php
|
541 |
+
|
542 |
+
}
|
543 |
+
|
544 |
}
|
545 |
+
|
546 |
}
|
547 |
+
|
548 |
function init_WP_Widget_Ultimate_Posts() {
|
549 |
+
|
550 |
register_widget( 'WP_Widget_Ultimate_Posts' );
|
551 |
+
|
552 |
}
|
553 |
+
|
554 |
add_action( 'widgets_init', 'init_WP_Widget_Ultimate_Posts' );
|
555 |
|
556 |
}
|