Version Description
- Added show author option
- Added class to highlight current post
- Fixed PHP error notices
Download this release
Release Info
Developer | bostondv |
Plugin | Ultimate Posts Widget |
Version | 1.7 |
Comparing to | |
See all releases |
Code changes from version 1.6 to 1.7
- .gitignore +1 -1
- cache/index.html +0 -0
- cache/timthumb_cacheLastCleanTime.touch +0 -0
- readme.txt +12 -4
- screenshot-1.png +0 -0
- ultimate-posts-widget.php +104 -84
.gitignore
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
.svn
|
2 |
-
cache
|
1 |
.svn
|
2 |
+
cache/timthumb_int*
|
cache/index.html
ADDED
File without changes
|
cache/timthumb_cacheLastCleanTime.touch
ADDED
File without changes
|
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 |
|
@@ -24,6 +24,7 @@ Options:
|
|
24 |
* Display title
|
25 |
* Display publish date
|
26 |
* Display publish time
|
|
|
27 |
* Display excerpt
|
28 |
* Display read more link
|
29 |
* Display featured image
|
@@ -37,7 +38,7 @@ Options:
|
|
37 |
* Feature image crop mode
|
38 |
* Order by date, title, number of comments or random
|
39 |
|
40 |
-
For support please use [wordpress.org](http://wordpress.org/support/plugin/ultimate-posts-widget). Visit [our website](http://pomelodesign.com), follow [@
|
41 |
|
42 |
Fork or contribute on [Github](https://github.com/bostondv/ultimate-posts-widget)
|
43 |
|
@@ -47,11 +48,12 @@ Fork or contribute on [Github](https://github.com/bostondv/ultimate-posts-widget
|
|
47 |
|
48 |
This plugin uses the [TimThumb library](http://www.binarymoon.co.uk/projects/timthumb/) to resize post thumbnails. Please review these requirements and troubleshooting tips if you are having problems displaying thumbnails.
|
49 |
|
|
|
50 |
* JetPack plugin - There is a known conflict between JetPack's "Photon" component, please disable it for compatibility with TimThumb.
|
51 |
* Server requirements - PHP and the GD image library must be installed on your web server. Normally most web servers include them by default.
|
52 |
* Cache permissions - The cache directory `wp-content/plugins/ultimate-posts-widget/cache` should be set to 777 or if that doesn't work, you may find 755 is ok.
|
53 |
* Image sizes - TimThumb is configured to only work for images smaller than 1500 x 1500. The plugin and automatically selects the "Large" size from Settings > Media, if it is greater than 1500 x 1500 you will need to reduce the size or modify the configuration in `thumb.php` to support larger image sizes.
|
54 |
-
*
|
55 |
|
56 |
Still stuck? See [additional troubleshooting tips](http://www.binarymoon.co.uk/2010/11/timthumb-hints-tips/) from the TimThumb author.
|
57 |
|
@@ -61,6 +63,12 @@ Still stuck? See [additional troubleshooting tips](http://www.binarymoon.co.uk/2
|
|
61 |
|
62 |
== Changelog ==
|
63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
= 1.6 =
|
65 |
|
66 |
* Added localization support
|
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.6
|
7 |
+
Stable tag: 1.7
|
8 |
License: GPL2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
24 |
* Display title
|
25 |
* Display publish date
|
26 |
* Display publish time
|
27 |
+
* Display post author
|
28 |
* Display excerpt
|
29 |
* Display read more link
|
30 |
* Display featured image
|
38 |
* Feature image crop mode
|
39 |
* Order by date, title, number of comments or random
|
40 |
|
41 |
+
For support please use [wordpress.org](http://wordpress.org/support/plugin/ultimate-posts-widget). Visit [our website](http://pomelodesign.com), follow [@bostondv](http://twitter.com/bostondv/) for updates.
|
42 |
|
43 |
Fork or contribute on [Github](https://github.com/bostondv/ultimate-posts-widget)
|
44 |
|
48 |
|
49 |
This plugin uses the [TimThumb library](http://www.binarymoon.co.uk/projects/timthumb/) to resize post thumbnails. Please review these requirements and troubleshooting tips if you are having problems displaying thumbnails.
|
50 |
|
51 |
+
* Right click > view image - If an image isn't loading then this is the first thing you should do. 9 times out of 10 it will tell you what the problem is in an easy to read error message.
|
52 |
* JetPack plugin - There is a known conflict between JetPack's "Photon" component, please disable it for compatibility with TimThumb.
|
53 |
* Server requirements - PHP and the GD image library must be installed on your web server. Normally most web servers include them by default.
|
54 |
* Cache permissions - The cache directory `wp-content/plugins/ultimate-posts-widget/cache` should be set to 777 or if that doesn't work, you may find 755 is ok.
|
55 |
* Image sizes - TimThumb is configured to only work for images smaller than 1500 x 1500. The plugin and automatically selects the "Large" size from Settings > Media, if it is greater than 1500 x 1500 you will need to reduce the size or modify the configuration in `thumb.php` to support larger image sizes.
|
56 |
+
* Tilde(~) in url - Timthumb has a known issue with this, please use a url without a tilde until a fix is available. [Bug report](https://code.google.com/p/timthumb/issues/detail?id=263)
|
57 |
|
58 |
Still stuck? See [additional troubleshooting tips](http://www.binarymoon.co.uk/2010/11/timthumb-hints-tips/) from the TimThumb author.
|
59 |
|
63 |
|
64 |
== Changelog ==
|
65 |
|
66 |
+
= 1.7 =
|
67 |
+
|
68 |
+
* Added show author option
|
69 |
+
* Added class to highlight current post
|
70 |
+
* Fixed PHP error notices
|
71 |
+
|
72 |
= 1.6 =
|
73 |
|
74 |
* Added localization support
|
screenshot-1.png
CHANGED
Binary file
|
ultimate-posts-widget.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Ultimate Posts Widget
|
4 |
-
Plugin URI: http://
|
5 |
Description: The ultimate widget for displaying posts, custom post types or sticky posts with an array of options.
|
6 |
-
Version: 1.
|
7 |
-
Author:
|
8 |
Author URI: http://pomelodesign.com
|
9 |
License: GPL2
|
10 |
|
@@ -43,6 +43,9 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
43 |
|
44 |
function widget( $args, $instance ) {
|
45 |
|
|
|
|
|
|
|
46 |
if( !function_exists('get_image_path') ) {
|
47 |
function get_image_path($src) {
|
48 |
global $blog_id;
|
@@ -144,11 +147,9 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
144 |
|
145 |
while ( $r->have_posts() ) : $r->the_post();
|
146 |
|
147 |
-
global $post;
|
148 |
-
|
149 |
?>
|
150 |
|
151 |
-
<li>
|
152 |
|
153 |
<?php
|
154 |
if ( function_exists('the_post_thumbnail') &&
|
@@ -191,6 +192,13 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
191 |
</p>
|
192 |
<?php endif; ?>
|
193 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
<?php if ( $instance['show_excerpt'] ) :
|
195 |
if ( $instance['show_readmore'] ) : $linkmore = ' <a href="'.get_permalink().'" class="more-link">'.$excerpt_readmore.'</a>'; else: $linkmore =''; endif; ?>
|
196 |
<p class="post-excerpt"><?php echo get_the_excerpt() . $linkmore; ?></p>
|
@@ -243,35 +251,32 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
243 |
function update( $new_instance, $old_instance ) {
|
244 |
$instance = $old_instance;
|
245 |
|
246 |
-
//Let's turn that array into something the Wordpress database can store
|
247 |
-
$types = implode(',', (array)$new_instance['types']);
|
248 |
-
$cats = implode(',', (array)$new_instance['cats']);
|
249 |
-
|
250 |
$instance['title'] = strip_tags( $new_instance['title'] );
|
251 |
$instance['title_link'] = strip_tags( $new_instance['title_link'] );
|
252 |
$instance['number'] = strip_tags( $new_instance['number'] );
|
253 |
-
$instance['types'] = $types;
|
254 |
-
$instance['cats'] = $cats;
|
255 |
-
$instance['atcat'] = $new_instance['atcat'];
|
256 |
-
$instance['show_excerpt'] = $new_instance['show_excerpt'];
|
257 |
-
$instance['show_thumbnail'] = $new_instance['show_thumbnail'];
|
258 |
-
$instance['show_date'] = $new_instance['show_date'];
|
259 |
-
$instance['show_time'] = $new_instance['show_time'];
|
260 |
-
$instance['show_title'] = $new_instance['show_title'];
|
|
|
261 |
$instance['thumb_w'] = strip_tags( $new_instance['thumb_w'] );
|
262 |
$instance['thumb_h'] = strip_tags( $new_instance['thumb_h'] );
|
263 |
$instance['thumb_crop'] = $new_instance['thumb_crop'];
|
264 |
-
$instance['show_readmore'] = $new_instance['show_readmore'];
|
265 |
$instance['excerpt_length'] = strip_tags( $new_instance['excerpt_length'] );
|
266 |
$instance['excerpt_readmore'] = strip_tags( $new_instance['excerpt_readmore'] );
|
267 |
$instance['sticky'] = $new_instance['sticky'];
|
268 |
$instance['order'] = $new_instance['order'];
|
269 |
$instance['orderby'] = $new_instance['orderby'];
|
270 |
-
$instance['show_morebutton'] = $new_instance['show_morebutton'];
|
271 |
$instance['morebutton_url'] = strip_tags( $new_instance['morebutton_url'] );
|
272 |
$instance['morebutton_text'] = strip_tags( $new_instance['morebutton_text'] );
|
273 |
-
$instance['show_cats'] = $new_instance['show_cats'];
|
274 |
-
$instance['show_tags'] = $new_instance['show_tags'];
|
275 |
|
276 |
|
277 |
$this->flush_widget_cache();
|
@@ -292,53 +297,63 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
292 |
|
293 |
function form( $instance ) {
|
294 |
|
295 |
-
//
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
342 |
|
343 |
//Let's turn $types and $cats into an array
|
344 |
$types = explode(',', $types);
|
@@ -372,22 +387,27 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
372 |
<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>
|
373 |
|
374 |
<p>
|
375 |
-
<input class="checkbox" id="<?php echo $this->get_field_id( 'show_title' ); ?>" name="<?php echo $this->get_field_name( 'show_title' ); ?>" type="checkbox" <?php checked( (bool) $
|
376 |
<label for="<?php echo $this->get_field_id( 'show_title' ); ?>"><?php _e( 'Show title', 'upw' ); ?></label>
|
377 |
</p>
|
378 |
|
379 |
<p>
|
380 |
-
<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) $
|
381 |
<label for="<?php echo $this->get_field_id( 'show_date' ); ?>"><?php _e( 'Show published date', 'upw' ); ?></label>
|
382 |
</p>
|
383 |
|
384 |
<p>
|
385 |
-
<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) $
|
386 |
<label for="<?php echo $this->get_field_id( 'show_time' ); ?>"><?php _e( 'Show published time', 'upw' ); ?></label>
|
387 |
</p>
|
388 |
|
389 |
<p>
|
390 |
-
<input class="checkbox" id="<?php echo $this->get_field_id( '
|
|
|
|
|
|
|
|
|
|
|
391 |
<label for="<?php echo $this->get_field_id( 'show_excerpt' ); ?>"><?php _e( 'Show excerpt', 'upw' ); ?></label>
|
392 |
</p>
|
393 |
|
@@ -398,7 +418,7 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
398 |
|
399 |
<p>
|
400 |
<label for="<?php echo $this->get_field_id('show_readmore'); ?>">
|
401 |
-
<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_readmore'); ?>" name="<?php echo $this->get_field_name('show_readmore'); ?>"<?php checked( (bool) $
|
402 |
<?php _e( 'Show read more link', 'upw' ); ?>
|
403 |
</label>
|
404 |
</p>
|
@@ -411,7 +431,7 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
411 |
<?php if ( function_exists('the_post_thumbnail') && current_theme_supports( 'post-thumbnails' ) ) : ?>
|
412 |
|
413 |
<p>
|
414 |
-
<input class="checkbox" id="<?php echo $this->get_field_id( 'show_thumbnail' ); ?>" name="<?php echo $this->get_field_name( 'show_thumbnail' ); ?>" type="checkbox" <?php checked( (bool) $
|
415 |
<label for="<?php echo $this->get_field_id( 'show_thumbnail' ); ?>"><?php _e( 'Show thumbnail', 'upw' ); ?></label>
|
416 |
</p>
|
417 |
|
@@ -440,7 +460,7 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
440 |
<?php endif; ?>
|
441 |
|
442 |
<p>
|
443 |
-
<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_morebutton'); ?>" name="<?php echo $this->get_field_name('show_morebutton'); ?>" <?php checked( (bool) $
|
444 |
<label for="<?php echo $this->get_field_id('show_morebutton'); ?>"> <?php _e('Show more button', 'upw'); ?></label>
|
445 |
</p>
|
446 |
|
@@ -455,17 +475,17 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
455 |
</p>
|
456 |
|
457 |
<p>
|
458 |
-
<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('atcat'); ?>" name="<?php echo $this->get_field_name('atcat'); ?>" <?php checked( (bool) $
|
459 |
<label for="<?php echo $this->get_field_id('atcat'); ?>"> <?php _e('Show posts only from current category', 'upw');?></label>
|
460 |
</p>
|
461 |
|
462 |
<p>
|
463 |
-
<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_cats'); ?>" name="<?php echo $this->get_field_name('show_cats'); ?>" <?php checked( (bool) $
|
464 |
<label for="<?php echo $this->get_field_id('show_cats'); ?>"> <?php _e('Show post categories', 'upw'); ?></label>
|
465 |
</p>
|
466 |
|
467 |
<p>
|
468 |
-
<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_tags'); ?>" name="<?php echo $this->get_field_name('show_tags'); ?>" <?php checked( (bool) $
|
469 |
<label for="<?php echo $this->get_field_id('show_tags'); ?>"> <?php _e('Show post tags', 'upw'); ?></label>
|
470 |
</p>
|
471 |
|
@@ -541,17 +561,17 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
541 |
<?php
|
542 |
// Use PHP to determine if not checked and hide if so
|
543 |
// jQuery method was acting up
|
544 |
-
if ( !$
|
545 |
echo 'excerpt_length.hide();';
|
546 |
}
|
547 |
-
if ( !$
|
548 |
echo 'excerpt_readmore.hide();';
|
549 |
}
|
550 |
-
if ( !$
|
551 |
echo 'thumb_w.hide();';
|
552 |
echo 'thumb_crop.hide();';
|
553 |
}
|
554 |
-
if ( !$
|
555 |
echo 'morebutton_text.hide();';
|
556 |
echo 'morebutton_url.hide();';
|
557 |
}
|
@@ -625,4 +645,4 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
625 |
|
626 |
add_action( 'widgets_init', 'init_WP_Widget_Ultimate_Posts' );
|
627 |
|
628 |
-
}
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Ultimate Posts Widget
|
4 |
+
Plugin URI: http://wordpress.org/plugins/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
|
7 |
+
Author: Boston Dell-Vandenberg
|
8 |
Author URI: http://pomelodesign.com
|
9 |
License: GPL2
|
10 |
|
43 |
|
44 |
function widget( $args, $instance ) {
|
45 |
|
46 |
+
global $post;
|
47 |
+
$current_post_id = $post->ID;
|
48 |
+
|
49 |
if( !function_exists('get_image_path') ) {
|
50 |
function get_image_path($src) {
|
51 |
global $blog_id;
|
147 |
|
148 |
while ( $r->have_posts() ) : $r->the_post();
|
149 |
|
|
|
|
|
150 |
?>
|
151 |
|
152 |
+
<li class="<?php echo ($post->ID == $current_post_id && is_single())?'current-post-item':'' ?>">
|
153 |
|
154 |
<?php
|
155 |
if ( function_exists('the_post_thumbnail') &&
|
192 |
</p>
|
193 |
<?php endif; ?>
|
194 |
|
195 |
+
<?php if( $instance['show_author'] ) : ?>
|
196 |
+
<p class="post-author">
|
197 |
+
<span class="post-author-label"><?php _e('By', 'upw'); ?>:</span>
|
198 |
+
<?php the_author_posts_link(); ?>
|
199 |
+
</p>
|
200 |
+
<?php endif; ?>
|
201 |
+
|
202 |
<?php if ( $instance['show_excerpt'] ) :
|
203 |
if ( $instance['show_readmore'] ) : $linkmore = ' <a href="'.get_permalink().'" class="more-link">'.$excerpt_readmore.'</a>'; else: $linkmore =''; endif; ?>
|
204 |
<p class="post-excerpt"><?php echo get_the_excerpt() . $linkmore; ?></p>
|
251 |
function update( $new_instance, $old_instance ) {
|
252 |
$instance = $old_instance;
|
253 |
|
|
|
|
|
|
|
|
|
254 |
$instance['title'] = strip_tags( $new_instance['title'] );
|
255 |
$instance['title_link'] = strip_tags( $new_instance['title_link'] );
|
256 |
$instance['number'] = strip_tags( $new_instance['number'] );
|
257 |
+
$instance['types'] = (isset( $new_instance['types'] )) ? implode(',', (array) $new_instance['types']) : '';
|
258 |
+
$instance['cats'] = (isset( $new_instance['cats'] )) ? implode(',', (array) $new_instance['cats']) : '';
|
259 |
+
$instance['atcat'] = isset( $new_instance['atcat'] );
|
260 |
+
$instance['show_excerpt'] = isset( $new_instance['show_excerpt'] );
|
261 |
+
$instance['show_thumbnail'] = isset( $new_instance['show_thumbnail'] );
|
262 |
+
$instance['show_date'] = isset( $new_instance['show_date'] );
|
263 |
+
$instance['show_time'] = isset( $new_instance['show_time'] );
|
264 |
+
$instance['show_title'] = isset( $new_instance['show_title'] );
|
265 |
+
$instance['show_author'] = isset( $new_instance['show_author'] );
|
266 |
$instance['thumb_w'] = strip_tags( $new_instance['thumb_w'] );
|
267 |
$instance['thumb_h'] = strip_tags( $new_instance['thumb_h'] );
|
268 |
$instance['thumb_crop'] = $new_instance['thumb_crop'];
|
269 |
+
$instance['show_readmore'] = isset( $new_instance['show_readmore']);
|
270 |
$instance['excerpt_length'] = strip_tags( $new_instance['excerpt_length'] );
|
271 |
$instance['excerpt_readmore'] = strip_tags( $new_instance['excerpt_readmore'] );
|
272 |
$instance['sticky'] = $new_instance['sticky'];
|
273 |
$instance['order'] = $new_instance['order'];
|
274 |
$instance['orderby'] = $new_instance['orderby'];
|
275 |
+
$instance['show_morebutton'] = isset( $new_instance['show_morebutton'] );
|
276 |
$instance['morebutton_url'] = strip_tags( $new_instance['morebutton_url'] );
|
277 |
$instance['morebutton_text'] = strip_tags( $new_instance['morebutton_text'] );
|
278 |
+
$instance['show_cats'] = isset( $new_instance['show_cats'] );
|
279 |
+
$instance['show_tags'] = isset( $new_instance['show_tags'] );
|
280 |
|
281 |
|
282 |
$this->flush_widget_cache();
|
297 |
|
298 |
function form( $instance ) {
|
299 |
|
300 |
+
// Set default arguments
|
301 |
+
$instance = wp_parse_args( (array) $instance, array(
|
302 |
+
'title' => '',
|
303 |
+
'title_link' => '' ,
|
304 |
+
'number' => '5',
|
305 |
+
'types' => 'post',
|
306 |
+
'cats' => '',
|
307 |
+
'atcat' => false,
|
308 |
+
'thumb_w' => 100,
|
309 |
+
'thumb_h' => 100,
|
310 |
+
'thumb_crop' => 1,
|
311 |
+
'excerpt_length' => 10,
|
312 |
+
'excerpt_readmore' => __('Read more →', 'upw'),
|
313 |
+
'order' => 'DESC',
|
314 |
+
'orderby' => 'date',
|
315 |
+
'morebutton_text' => __('View More Posts', 'upw'),
|
316 |
+
'morebutton_url' => site_url(),
|
317 |
+
'sticky' => 'show',
|
318 |
+
'show_cats' => false,
|
319 |
+
'show_tags' => false,
|
320 |
+
'show_title' => false,
|
321 |
+
'show_date' => false,
|
322 |
+
'show_time' => false,
|
323 |
+
'show_author' => false,
|
324 |
+
'show_excerpt' => false,
|
325 |
+
'show_readmore' => false,
|
326 |
+
'show_thumbnail' => false,
|
327 |
+
'show_morebutton' => false
|
328 |
+
) );
|
329 |
+
|
330 |
+
// Or use the instance
|
331 |
+
$title = strip_tags($instance['title']);
|
332 |
+
$title_link = strip_tags($instance['title_link']);
|
333 |
+
$number = strip_tags($instance['number']);
|
334 |
+
$types = $instance['types'];
|
335 |
+
$cats = $instance['cats'];
|
336 |
+
$atcat = $instance['atcat'];
|
337 |
+
$thumb_w = strip_tags($instance['thumb_w']);
|
338 |
+
$thumb_h = strip_tags($instance['thumb_h']);
|
339 |
+
$thumb_crop = strip_tags($instance['thumb_crop']);
|
340 |
+
$excerpt_length = strip_tags($instance['excerpt_length']);
|
341 |
+
$excerpt_readmore = strip_tags($instance['excerpt_readmore']);
|
342 |
+
$order = $instance['order'];
|
343 |
+
$orderby = $instance['orderby'];
|
344 |
+
$morebutton_text = strip_tags($instance['morebutton_text']);
|
345 |
+
$morebutton_url = strip_tags($instance['morebutton_url']);
|
346 |
+
$sticky = $instance['sticky'];
|
347 |
+
$show_cats = $instance['show_cats'];
|
348 |
+
$show_tags = $instance['show_tags'];
|
349 |
+
$show_title = $instance['show_title'];
|
350 |
+
$show_date = $instance['show_date'];
|
351 |
+
$show_time = $instance['show_time'];
|
352 |
+
$show_author = $instance['show_author'];
|
353 |
+
$show_excerpt = $instance['show_excerpt'];
|
354 |
+
$show_readmore = $instance['show_readmore'];
|
355 |
+
$show_thumbnail = $instance['show_thumbnail'];
|
356 |
+
$show_morebutton = $instance['show_morebutton'];
|
357 |
|
358 |
//Let's turn $types and $cats into an array
|
359 |
$types = explode(',', $types);
|
387 |
<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>
|
388 |
|
389 |
<p>
|
390 |
+
<input class="checkbox" id="<?php echo $this->get_field_id( 'show_title' ); ?>" name="<?php echo $this->get_field_name( 'show_title' ); ?>" type="checkbox" <?php checked( (bool) $show_title, true ); ?> />
|
391 |
<label for="<?php echo $this->get_field_id( 'show_title' ); ?>"><?php _e( 'Show title', 'upw' ); ?></label>
|
392 |
</p>
|
393 |
|
394 |
<p>
|
395 |
+
<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) $show_date, true ); ?> />
|
396 |
<label for="<?php echo $this->get_field_id( 'show_date' ); ?>"><?php _e( 'Show published date', 'upw' ); ?></label>
|
397 |
</p>
|
398 |
|
399 |
<p>
|
400 |
+
<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) $show_time, true ); ?> />
|
401 |
<label for="<?php echo $this->get_field_id( 'show_time' ); ?>"><?php _e( 'Show published time', 'upw' ); ?></label>
|
402 |
</p>
|
403 |
|
404 |
<p>
|
405 |
+
<input class="checkbox" id="<?php echo $this->get_field_id( 'show_author' ); ?>" name="<?php echo $this->get_field_name( 'show_author' ); ?>" type="checkbox" <?php checked( (bool) $show_author, true ); ?> />
|
406 |
+
<label for="<?php echo $this->get_field_id( 'show_author' ); ?>"><?php _e( 'Show post author', 'upw' ); ?></label>
|
407 |
+
</p>
|
408 |
+
|
409 |
+
<p>
|
410 |
+
<input class="checkbox" id="<?php echo $this->get_field_id( 'show_excerpt' ); ?>" name="<?php echo $this->get_field_name( 'show_excerpt' ); ?>" type="checkbox" <?php checked( (bool) $show_excerpt, true ); ?> />
|
411 |
<label for="<?php echo $this->get_field_id( 'show_excerpt' ); ?>"><?php _e( 'Show excerpt', 'upw' ); ?></label>
|
412 |
</p>
|
413 |
|
418 |
|
419 |
<p>
|
420 |
<label for="<?php echo $this->get_field_id('show_readmore'); ?>">
|
421 |
+
<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_readmore'); ?>" name="<?php echo $this->get_field_name('show_readmore'); ?>"<?php checked( (bool) $show_readmore, true ); ?> />
|
422 |
<?php _e( 'Show read more link', 'upw' ); ?>
|
423 |
</label>
|
424 |
</p>
|
431 |
<?php if ( function_exists('the_post_thumbnail') && current_theme_supports( 'post-thumbnails' ) ) : ?>
|
432 |
|
433 |
<p>
|
434 |
+
<input class="checkbox" id="<?php echo $this->get_field_id( 'show_thumbnail' ); ?>" name="<?php echo $this->get_field_name( 'show_thumbnail' ); ?>" type="checkbox" <?php checked( (bool) $show_thumbnail, true ); ?> />
|
435 |
<label for="<?php echo $this->get_field_id( 'show_thumbnail' ); ?>"><?php _e( 'Show thumbnail', 'upw' ); ?></label>
|
436 |
</p>
|
437 |
|
460 |
<?php endif; ?>
|
461 |
|
462 |
<p>
|
463 |
+
<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_morebutton'); ?>" name="<?php echo $this->get_field_name('show_morebutton'); ?>" <?php checked( (bool) $show_morebutton, true ); ?> />
|
464 |
<label for="<?php echo $this->get_field_id('show_morebutton'); ?>"> <?php _e('Show more button', 'upw'); ?></label>
|
465 |
</p>
|
466 |
|
475 |
</p>
|
476 |
|
477 |
<p>
|
478 |
+
<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('atcat'); ?>" name="<?php echo $this->get_field_name('atcat'); ?>" <?php checked( (bool) $atcat, true ); ?> />
|
479 |
<label for="<?php echo $this->get_field_id('atcat'); ?>"> <?php _e('Show posts only from current category', 'upw');?></label>
|
480 |
</p>
|
481 |
|
482 |
<p>
|
483 |
+
<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_cats'); ?>" name="<?php echo $this->get_field_name('show_cats'); ?>" <?php checked( (bool) $show_cats, true ); ?> />
|
484 |
<label for="<?php echo $this->get_field_id('show_cats'); ?>"> <?php _e('Show post categories', 'upw'); ?></label>
|
485 |
</p>
|
486 |
|
487 |
<p>
|
488 |
+
<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_tags'); ?>" name="<?php echo $this->get_field_name('show_tags'); ?>" <?php checked( (bool) $show_tags, true ); ?> />
|
489 |
<label for="<?php echo $this->get_field_id('show_tags'); ?>"> <?php _e('Show post tags', 'upw'); ?></label>
|
490 |
</p>
|
491 |
|
561 |
<?php
|
562 |
// Use PHP to determine if not checked and hide if so
|
563 |
// jQuery method was acting up
|
564 |
+
if ( !$show_excerpt ) {
|
565 |
echo 'excerpt_length.hide();';
|
566 |
}
|
567 |
+
if ( !$show_readmore ) {
|
568 |
echo 'excerpt_readmore.hide();';
|
569 |
}
|
570 |
+
if ( !$show_thumbnail ) {
|
571 |
echo 'thumb_w.hide();';
|
572 |
echo 'thumb_crop.hide();';
|
573 |
}
|
574 |
+
if ( !$show_morebutton ) {
|
575 |
echo 'morebutton_text.hide();';
|
576 |
echo 'morebutton_url.hide();';
|
577 |
}
|
645 |
|
646 |
add_action( 'widgets_init', 'init_WP_Widget_Ultimate_Posts' );
|
647 |
|
648 |
+
}
|