Version Description
- Added localization support
- Added show post categories option
- Added show post tags option
- Added custom widget title URL option
- Improved filter controls for sticky posts
- Bug fixes
Download this release
Release Info
Developer | bostondv |
Plugin | Ultimate Posts Widget |
Version | 1.6 |
Comparing to | |
See all releases |
Code changes from version 1.5.1 to 1.6
- readme.txt +13 -1
- screenshot-1.png +0 -0
- ultimate-posts-widget.php +122 -50
readme.txt
CHANGED
@@ -4,7 +4,7 @@ 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.
|
8 |
License: GPL2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -28,6 +28,9 @@ Options:
|
|
28 |
* Display read more link
|
29 |
* Display featured image
|
30 |
* Display more button link
|
|
|
|
|
|
|
31 |
* Custom read more link text
|
32 |
* Custom excerpt length (in words)
|
33 |
* Custom featured image size
|
@@ -58,6 +61,15 @@ Still stuck? See [additional troubleshooting tips](http://www.binarymoon.co.uk/2
|
|
58 |
|
59 |
== Changelog ==
|
60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
= 1.5.1 =
|
62 |
|
63 |
* Upgrade timthumb to 2.8.11
|
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.6
|
8 |
License: GPL2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
28 |
* Display read more link
|
29 |
* Display featured image
|
30 |
* Display more button link
|
31 |
+
* Display post categories
|
32 |
+
* Display post tags
|
33 |
+
* Custom widget title link
|
34 |
* Custom read more link text
|
35 |
* Custom excerpt length (in words)
|
36 |
* Custom featured image size
|
61 |
|
62 |
== Changelog ==
|
63 |
|
64 |
+
= 1.6 =
|
65 |
+
|
66 |
+
* Added localization support
|
67 |
+
* Added show post categories option
|
68 |
+
* Added show post tags option
|
69 |
+
* Added custom widget title URL option
|
70 |
+
* Improved filter controls for sticky posts
|
71 |
+
* Bug fixes
|
72 |
+
|
73 |
= 1.5.1 =
|
74 |
|
75 |
* Upgrade timthumb to 2.8.11
|
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
|
@@ -29,14 +29,16 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
29 |
|
30 |
function WP_Widget_Ultimate_Posts() {
|
31 |
|
32 |
-
$widget_ops = array( 'classname' => 'widget_ultimate_posts', 'description' => __( 'Displays
|
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 ) {
|
@@ -68,6 +70,7 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
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']) : '');
|
@@ -77,10 +80,19 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
77 |
$thumb_crop = $instance['thumb_crop'];
|
78 |
$excerpt_length = $instance['excerpt_length'];
|
79 |
$excerpt_readmore = $instance['excerpt_readmore'];
|
80 |
-
$sticky =
|
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');
|
@@ -104,17 +116,26 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
104 |
if ( $instance["excerpt_length"] > 0 ) add_filter('excerpt_length', $new_excerpt_length);
|
105 |
|
106 |
echo $before_widget;
|
107 |
-
if ( $title )
|
|
|
|
|
|
|
|
|
|
|
|
|
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() ) :
|
@@ -149,9 +170,11 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
149 |
<div class="upw-content">
|
150 |
|
151 |
<?php if ( get_the_title() && $instance['show_title'] ) : ?>
|
152 |
-
<
|
153 |
-
<?php
|
154 |
-
|
|
|
|
|
155 |
<?php endif; ?>
|
156 |
|
157 |
<?php if ( $instance['show_date'] || $instance['show_time'] ) : ?>
|
@@ -173,6 +196,19 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
173 |
<p class="post-excerpt"><?php echo get_the_excerpt() . $linkmore; ?></p>
|
174 |
<?php endif; ?>
|
175 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
</div>
|
177 |
|
178 |
</li>
|
@@ -192,7 +228,7 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
192 |
|
193 |
else :
|
194 |
|
195 |
-
echo __('No posts found.');
|
196 |
|
197 |
endif;
|
198 |
|
@@ -212,6 +248,7 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
212 |
$cats = implode(',', (array)$new_instance['cats']);
|
213 |
|
214 |
$instance['title'] = strip_tags( $new_instance['title'] );
|
|
|
215 |
$instance['number'] = strip_tags( $new_instance['number'] );
|
216 |
$instance['types'] = $types;
|
217 |
$instance['cats'] = $cats;
|
@@ -233,6 +270,8 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
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();
|
@@ -256,6 +295,7 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
256 |
// instance exist? if not set defaults
|
257 |
if ( $instance ) {
|
258 |
$title = $instance['title'];
|
|
|
259 |
$number = $instance['number'];
|
260 |
$types = $instance['types'];
|
261 |
$cats = $instance['cats'];
|
@@ -268,9 +308,13 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
268 |
$orderby = $instance['orderby'];
|
269 |
$morebutton_text = $instance['morebutton_text'];
|
270 |
$morebutton_url = $instance['morebutton_url'];
|
|
|
|
|
|
|
271 |
} else {
|
272 |
//These are our defaults
|
273 |
$title = '';
|
|
|
274 |
$number = '5';
|
275 |
$types = 'post';
|
276 |
$cats = '';
|
@@ -278,11 +322,22 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
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 |
}
|
287 |
|
288 |
//Let's turn $types and $cats into an array
|
@@ -307,75 +362,78 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
307 |
|
308 |
?>
|
309 |
|
310 |
-
<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title
|
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( '
|
|
|
|
|
|
|
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 |
|
316 |
<p>
|
317 |
<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) $instance["show_title"], true ); ?> />
|
318 |
-
<label for="<?php echo $this->get_field_id( 'show_title' ); ?>"><?php _e( 'Show title' ); ?></label>
|
319 |
</p>
|
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>
|
332 |
<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) $instance["show_excerpt"], true ); ?> />
|
333 |
-
<label for="<?php echo $this->get_field_id( 'show_excerpt' ); ?>"><?php _e( 'Show excerpt' ); ?></label>
|
334 |
</p>
|
335 |
|
336 |
<p>
|
337 |
-
<label for="<?php echo $this->get_field_id(
|
338 |
-
<input style="text-align: center;" type="text" id="<?php echo $this->get_field_id(
|
339 |
</p>
|
340 |
|
341 |
<p>
|
342 |
<label for="<?php echo $this->get_field_id('show_readmore'); ?>">
|
343 |
-
<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id(
|
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
|
350 |
-
<input class="widefat" type="text" id="<?php echo $this->get_field_id('excerpt_readmore'); ?>" name="<?php echo $this->get_field_name(
|
351 |
</p>
|
352 |
|
353 |
<?php if ( function_exists('the_post_thumbnail') && current_theme_supports( 'post-thumbnails' ) ) : ?>
|
354 |
|
355 |
<p>
|
356 |
<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) $instance["show_thumbnail"], true ); ?> />
|
357 |
-
<label for="<?php echo $this->get_field_id( 'show_thumbnail' ); ?>"><?php _e( 'Show thumbnail' ); ?></label>
|
358 |
</p>
|
359 |
|
360 |
<p>
|
361 |
-
<label><?php _e('Thumbnail size
|
362 |
<br />
|
363 |
<label for="<?php echo $this->get_field_id('thumb_w'); ?>">
|
364 |
-
W
|
365 |
</label>
|
366 |
<label for="<?php echo $this->get_field_id('thumb_h'); ?>">
|
367 |
-
H
|
368 |
</label>
|
369 |
</p>
|
370 |
|
371 |
<p>
|
372 |
-
<label><?php _e('Crop mode
|
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 |
|
@@ -383,31 +441,36 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
383 |
|
384 |
<p>
|
385 |
<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) $instance['show_morebutton'], true ); ?> />
|
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
|
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
|
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>
|
398 |
|
399 |
<p>
|
400 |
-
<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('
|
401 |
-
<label for="<?php echo $this->get_field_id('
|
402 |
</p>
|
403 |
|
404 |
<p>
|
405 |
-
<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('
|
406 |
-
<label for="<?php echo $this->get_field_id('
|
407 |
</p>
|
408 |
|
409 |
<p>
|
410 |
-
|
|
|
|
|
|
|
|
|
|
|
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' );
|
@@ -418,7 +481,7 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
418 |
</p>
|
419 |
|
420 |
<p>
|
421 |
-
<label for="<?php echo $this->get_field_id('types'); ?>"><?php _e( 'Select post
|
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 );
|
@@ -430,24 +493,33 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
|
|
430 |
</p>
|
431 |
|
432 |
<p>
|
433 |
-
<label for="<?php echo $this->get_field_id('
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
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
|
451 |
|
452 |
<?php if ( $instance ) { ?>
|
453 |
|
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.6
|
7 |
Author: Pomelo Design
|
8 |
Author URI: http://pomelodesign.com
|
9 |
License: GPL2
|
29 |
|
30 |
function WP_Widget_Ultimate_Posts() {
|
31 |
|
32 |
+
$widget_ops = array( 'classname' => 'widget_ultimate_posts', 'description' => __( 'Displays list of posts with an array of options', 'upw' ) );
|
33 |
+
$this->WP_Widget( 'sticky-posts', __( 'Ultimate Posts', 'upw' ), $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 |
+
load_plugin_textdomain('upw', false, basename( dirname( __FILE__ ) ) . '/languages' );
|
41 |
+
|
42 |
}
|
43 |
|
44 |
function widget( $args, $instance ) {
|
70 |
extract( $args );
|
71 |
|
72 |
$title = apply_filters( 'widget_title', $instance['title'] );
|
73 |
+
$title_link = $instance['title_link'];
|
74 |
$number = $instance['number'];
|
75 |
$types = ($instance['types'] ? explode(',', $instance['types']) : '');
|
76 |
$cats = ($instance['cats'] ? explode(',', $instance['cats']) : '');
|
80 |
$thumb_crop = $instance['thumb_crop'];
|
81 |
$excerpt_length = $instance['excerpt_length'];
|
82 |
$excerpt_readmore = $instance['excerpt_readmore'];
|
83 |
+
$sticky = $instance['sticky'];
|
84 |
$order = $instance['order'];
|
85 |
$orderby = $instance['orderby'];
|
86 |
|
87 |
+
// Sticky posts
|
88 |
+
if ($sticky == 'only') {
|
89 |
+
$sticky_query = array( 'post__in' => get_option( 'sticky_posts' ) );
|
90 |
+
} elseif ($sticky == 'hide') {
|
91 |
+
$sticky_query = array( 'post__not_in' => get_option( 'sticky_posts' ) );
|
92 |
+
} else {
|
93 |
+
$sticky_query = null;
|
94 |
+
}
|
95 |
+
|
96 |
// If $atcat true and in category
|
97 |
if ($atcat && is_category()) {
|
98 |
$cats = get_query_var('cat');
|
116 |
if ( $instance["excerpt_length"] > 0 ) add_filter('excerpt_length', $new_excerpt_length);
|
117 |
|
118 |
echo $before_widget;
|
119 |
+
if ( $title ) {
|
120 |
+
echo $before_title;
|
121 |
+
if ( $title_link ) echo "<a href='$title_link'>";
|
122 |
+
echo $title;
|
123 |
+
if ( $title_link ) echo "</a>";
|
124 |
+
echo $after_title;
|
125 |
+
}
|
126 |
|
127 |
$args = array(
|
128 |
'showposts' => $number,
|
129 |
'order' => $order,
|
130 |
'orderby' => $orderby,
|
|
|
131 |
'category__in' => $cats,
|
132 |
'post_type' => $types
|
133 |
);
|
134 |
|
135 |
+
if (!empty($sticky_query)) {
|
136 |
+
$args[key($sticky_query)] = reset($sticky_query);
|
137 |
+
}
|
138 |
+
|
139 |
$r = new WP_Query( $args );
|
140 |
|
141 |
if ( $r->have_posts() ) :
|
170 |
<div class="upw-content">
|
171 |
|
172 |
<?php if ( get_the_title() && $instance['show_title'] ) : ?>
|
173 |
+
<p class="post-title">
|
174 |
+
<a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( get_the_title() ? get_the_title() : get_the_ID() ); ?>">
|
175 |
+
<?php the_title(); ?>
|
176 |
+
</a>
|
177 |
+
</p>
|
178 |
<?php endif; ?>
|
179 |
|
180 |
<?php if ( $instance['show_date'] || $instance['show_time'] ) : ?>
|
196 |
<p class="post-excerpt"><?php echo get_the_excerpt() . $linkmore; ?></p>
|
197 |
<?php endif; ?>
|
198 |
|
199 |
+
<?php if ( $instance['show_cats'] ) : ?>
|
200 |
+
<p class="post-cats">
|
201 |
+
<span class="post-cats-label"><?php _e('Categories', 'upw'); ?>:</span>
|
202 |
+
<span class="post-cats-list"><?php the_category(', '); ?></span>
|
203 |
+
</p>
|
204 |
+
<?php endif; ?>
|
205 |
+
|
206 |
+
<?php if ( $instance['show_tags'] ) : ?>
|
207 |
+
<p class="post-tags">
|
208 |
+
<span class="post-tags-label"><?php _e('Tags', 'upw'); ?>:</span>
|
209 |
+
<?php the_tags('<span class="post-tags-list">', ', ', '</span>'); ?>
|
210 |
+
</p>
|
211 |
+
<?php endif; ?>
|
212 |
</div>
|
213 |
|
214 |
</li>
|
228 |
|
229 |
else :
|
230 |
|
231 |
+
echo __('No posts found.', 'upw');
|
232 |
|
233 |
endif;
|
234 |
|
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;
|
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();
|
295 |
// instance exist? if not set defaults
|
296 |
if ( $instance ) {
|
297 |
$title = $instance['title'];
|
298 |
+
$title_link = $instance['title_link'];
|
299 |
$number = $instance['number'];
|
300 |
$types = $instance['types'];
|
301 |
$cats = $instance['cats'];
|
308 |
$orderby = $instance['orderby'];
|
309 |
$morebutton_text = $instance['morebutton_text'];
|
310 |
$morebutton_url = $instance['morebutton_url'];
|
311 |
+
$sticky = $instance['sticky'];
|
312 |
+
$show_cats = $instance['show_cats'];
|
313 |
+
$show_tags = $instance['show_tags'];
|
314 |
} else {
|
315 |
//These are our defaults
|
316 |
$title = '';
|
317 |
+
$title_link = '';
|
318 |
$number = '5';
|
319 |
$types = 'post';
|
320 |
$cats = '';
|
322 |
$thumb_h = 100;
|
323 |
$thumb_crop = 1;
|
324 |
$excerpt_length = 10;
|
325 |
+
$excerpt_readmore = __('Read more →', 'upw');
|
326 |
$order = 'DESC';
|
327 |
$orderby = 'date';
|
328 |
+
$morebutton_text = __('View More Posts', 'upw');
|
329 |
$morebutton_url = get_bloginfo('url');
|
330 |
+
$sticky = 'show';
|
331 |
+
$instance['show_title'] = false;
|
332 |
+
$instance['show_date'] = false;
|
333 |
+
$instance['show_time'] = false;
|
334 |
+
$instance['show_excerpt'] = false;
|
335 |
+
$instance['show_readmore'] = false;
|
336 |
+
$instance['show_thumbnail'] = false;
|
337 |
+
$instance['show_morebutton'] = false;
|
338 |
+
$instance['atcat'] = false;
|
339 |
+
$instance['show_cats'] = false;
|
340 |
+
$instance['show_tags'] = false;
|
341 |
}
|
342 |
|
343 |
//Let's turn $types and $cats into an array
|
362 |
|
363 |
?>
|
364 |
|
365 |
+
<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title', 'upw' ); ?>:</label>
|
366 |
<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>
|
367 |
|
368 |
+
<p><label for="<?php echo $this->get_field_id( 'title_link' ); ?>"><?php _e( 'Title URL', 'upw' ); ?>:</label>
|
369 |
+
<input class="widefat" id="<?php echo $this->get_field_id( 'title_link' ); ?>" name="<?php echo $this->get_field_name( 'title_link' ); ?>" type="text" value="<?php echo $title_link; ?>" /></p>
|
370 |
+
|
371 |
+
<p><label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of posts', 'upw' ); ?>:</label>
|
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) $instance["show_title"], true ); ?> />
|
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) $instance["show_date"], true ); ?> />
|
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) $instance["show_time"], true ); ?> />
|
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( 'show_excerpt' ); ?>" name="<?php echo $this->get_field_name( 'show_excerpt' ); ?>" type="checkbox" <?php checked( (bool) $instance["show_excerpt"], true ); ?> />
|
391 |
+
<label for="<?php echo $this->get_field_id( 'show_excerpt' ); ?>"><?php _e( 'Show excerpt', 'upw' ); ?></label>
|
392 |
</p>
|
393 |
|
394 |
<p>
|
395 |
+
<label for="<?php echo $this->get_field_id('excerpt_length'); ?>"><?php _e( 'Excerpt length (in words)', 'upw' ); ?>:</label>
|
396 |
+
<input style="text-align: center;" type="text" id="<?php echo $this->get_field_id('excerpt_length'); ?>" name="<?php echo $this->get_field_name('excerpt_length'); ?>" value="<?php echo $excerpt_length; ?>" size="3" />
|
397 |
</p>
|
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) $instance["show_readmore"], true ); ?> />
|
402 |
+
<?php _e( 'Show read more link', 'upw' ); ?>
|
403 |
</label>
|
404 |
</p>
|
405 |
|
406 |
<p>
|
407 |
+
<label for="<?php echo $this->get_field_id('excerpt_readmore'); ?>"><?php _e( 'Read more text', 'upw' ); ?>:</label>
|
408 |
+
<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; ?>" />
|
409 |
</p>
|
410 |
|
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) $instance["show_thumbnail"], true ); ?> />
|
415 |
+
<label for="<?php echo $this->get_field_id( 'show_thumbnail' ); ?>"><?php _e( 'Show thumbnail', 'upw' ); ?></label>
|
416 |
</p>
|
417 |
|
418 |
<p>
|
419 |
+
<label><?php _e('Thumbnail size', 'upw'); ?>:</label>
|
420 |
<br />
|
421 |
<label for="<?php echo $this->get_field_id('thumb_w'); ?>">
|
422 |
+
<?php _e('W', 'upw'); ?>: <input class="widefat" style="width:40%;" type="text" id="<?php echo $this->get_field_id('thumb_w'); ?>" name="<?php echo $this->get_field_name('thumb_w'); ?>" value="<?php echo $thumb_w; ?>" />
|
423 |
</label>
|
424 |
<label for="<?php echo $this->get_field_id('thumb_h'); ?>">
|
425 |
+
<?php _e('H', 'upw'); ?>: <input class="widefat" style="width:40%;" type="text" id="<?php echo $this->get_field_id('thumb_h'); ?>" name="<?php echo $this->get_field_name('thumb_h'); ?>" value="<?php echo $thumb_h; ?>" />
|
426 |
</label>
|
427 |
</p>
|
428 |
|
429 |
<p>
|
430 |
+
<label><?php _e('Crop mode', 'upw'); ?>:</label>
|
431 |
<br />
|
432 |
<select id="<?php echo $this->get_field_id('thumb_crop'); ?>" name="<?php echo $this->get_field_name('thumb_crop'); ?>">
|
433 |
+
<option value="1"<?php if($thumb_crop == 1) echo ' selected'; ?>><?php _e('Scale & Crop to Fit', 'upw'); ?></option>
|
434 |
+
<option value="0"<?php if($thumb_crop == 0) echo ' selected'; ?>><?php _e('Stretch to Fit', 'upw'); ?></option>
|
435 |
+
<option value="2"<?php if($thumb_crop == 2) echo ' selected'; ?>><?php _e('Proportional Scale', 'upw'); ?></option>
|
436 |
+
<option value="3"<?php if($thumb_crop == 3) echo ' selected'; ?>><?php _e('Proportional Scale No Borders', 'upw'); ?></option>
|
437 |
</select>
|
438 |
</p>
|
439 |
|
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) $instance['show_morebutton'], true ); ?> />
|
444 |
+
<label for="<?php echo $this->get_field_id('show_morebutton'); ?>"> <?php _e('Show more button', 'upw'); ?></label>
|
445 |
</p>
|
446 |
|
447 |
<p>
|
448 |
+
<label for="<?php echo $this->get_field_id('morebutton_text'); ?>"><?php _e( 'More button text', 'upw' ); ?>:</label>
|
449 |
<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; ?>" />
|
450 |
</p>
|
451 |
|
452 |
<p>
|
453 |
+
<label for="<?php echo $this->get_field_id('morebutton_url'); ?>"><?php _e( 'More button URL', 'upw' ); ?>:</label>
|
454 |
<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; ?>" />
|
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) $instance['atcat'], true ); ?> />
|
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) $instance['show_cats'], true ); ?> />
|
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) $instance['show_tags'], true ); ?> />
|
469 |
+
<label for="<?php echo $this->get_field_id('show_tags'); ?>"> <?php _e('Show post tags', 'upw'); ?></label>
|
470 |
+
</p>
|
471 |
+
|
472 |
+
<p>
|
473 |
+
<label for="<?php echo $this->get_field_id('cats'); ?>"><?php _e( 'Select categories', 'upw' ); ?>:</label>
|
474 |
<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>
|
475 |
<?php
|
476 |
$categories = get_categories( 'hide_empty=0' );
|
481 |
</p>
|
482 |
|
483 |
<p>
|
484 |
+
<label for="<?php echo $this->get_field_id('types'); ?>"><?php _e( 'Select post types', 'upw' ); ?>:</label>
|
485 |
<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>
|
486 |
<?php
|
487 |
$args = array( 'public' => true );
|
493 |
</p>
|
494 |
|
495 |
<p>
|
496 |
+
<label for="<?php echo $this->get_field_id('sticky'); ?>"><?php _e( 'Sticky posts', 'upw' ); ?>:</label>
|
497 |
+
<select name="<?php echo $this->get_field_name('sticky'); ?>" id="<?php echo $this->get_field_id('sticky'); ?>" class="widefat">
|
498 |
+
<option value="show"<?php if( $sticky === 'show') echo ' selected'; ?>><?php _e('Show All Posts', 'upw'); ?></option>
|
499 |
+
<option value="hide"<?php if( $sticky == 'hide') echo ' selected'; ?>><?php _e('Hide Sticky Posts', 'upw'); ?></option>
|
500 |
+
<option value="only"<?php if( $sticky == 'only') echo ' selected'; ?>><?php _e('Show Only Sticky Posts', 'upw'); ?></option>
|
501 |
+
</select>
|
502 |
+
</p>
|
503 |
+
|
504 |
+
<p>
|
505 |
+
<label for="<?php echo $this->get_field_id('orderby'); ?>"><?php _e( 'Order by', 'upw' ); ?>:</label>
|
506 |
<select name="<?php echo $this->get_field_name('orderby'); ?>" id="<?php echo $this->get_field_id('orderby'); ?>" class="widefat">
|
507 |
+
<option value="date"<?php if( $orderby == 'date') echo ' selected'; ?>><?php _e('Published Date', 'upw'); ?></option>
|
508 |
+
<option value="title"<?php if( $orderby == 'title') echo ' selected'; ?>><?php _e('Title', 'upw'); ?></option>
|
509 |
+
<option value="comment_count"<?php if( $orderby == 'comment_count') echo ' selected'; ?>><?php _e('Comment Count', 'upw'); ?></option>
|
510 |
<option value="rand"<?php if( $orderby == 'rand') echo ' selected'; ?>><?php _e('Random'); ?></option>
|
511 |
</select>
|
512 |
</p>
|
513 |
|
514 |
<p>
|
515 |
+
<label for="<?php echo $this->get_field_id('order'); ?>"><?php _e( 'Order', 'upw' ); ?>:</label>
|
516 |
<select name="<?php echo $this->get_field_name('order'); ?>" id="<?php echo $this->get_field_id('order'); ?>" class="widefat">
|
517 |
+
<option value="DESC"<?php if( $order == 'DESC') echo ' selected'; ?>><?php _e('Descending', 'upw'); ?></option>
|
518 |
+
<option value="ASC"<?php if( $order == 'ASC') echo ' selected'; ?>><?php _e('Ascending', 'upw'); ?></option>
|
519 |
</select>
|
520 |
</p>
|
521 |
|
522 |
+
<p class="credits"><small><?php _e('Developed by', 'upw'); ?> <a href="http://pomelodesign.com">Pomelo Design</a></small></p>
|
523 |
|
524 |
<?php if ( $instance ) { ?>
|
525 |
|