Changeset 659919
- Timestamp:
- 01/27/2013 10:50:10 PM (13 years ago)
- Location:
- bcd-upcoming-posts
- Files:
-
- 9 added
- 4 edited
-
assets/Thumbs.db (added)
-
assets/screenshot-1.png (modified) (previous)
-
assets/upcoming-posts-configure.png (added)
-
tags/1.4.0 (added)
-
tags/1.4.0/bcd-upcoming-posts.php (added)
-
tags/1.4.0/css (added)
-
tags/1.4.0/css/bcdup-css.css (added)
-
tags/1.4.0/readme.txt (added)
-
tags/1.4.0/scripts (added)
-
tags/1.4.0/scripts/bcdup-script.js (added)
-
trunk/bcd-upcoming-posts.php (modified) (7 diffs)
-
trunk/readme.txt (modified) (4 diffs)
-
trunk/scripts/bcdup-script.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
bcd-upcoming-posts/trunk/bcd-upcoming-posts.php
r637859 r659919 5 5 Description: Creates a widget that can be used to display upcoming posts. It can be customized to display a certain number of posts and in random order. Also, provides a shortcode to display the list. 6 6 Author: Frank Jones 7 Version: 1. 3.07 Version: 1.4.0 8 8 Author URI: http://www.duhjones.com/ 9 9 */ … … 43 43 'title' => '', 44 44 'posts_per_page' => '', 45 'random_order' => true,46 45 'display_as_link' => false, 47 46 'include_drafts' => false, 48 'include_only_drafts' => false 47 'include_only_drafts' => false, 48 'sort_order' => 'ASC' 49 49 ) 50 50 ); … … 67 67 $posts_per_page_field_name = $this->get_field_name('posts_per_page'); 68 68 $posts_per_page_value = attribute_escape($posts_per_page); 69 69 70 70 echo '<p>'; 71 71 echo $this->build_textbox( $posts_per_page_field_id, 'Number of posts to show', 'widefat', $posts_per_page_field_name, $posts_per_page_value ); 72 72 echo '</p>'; 73 73 74 75 74 // Show in random order 76 $random_order = $instance['random_order']; 77 $random_order_field_id = $this->get_field_id('random_order'); 78 $random_order_field_name = $this->get_field_name('random_order'); 79 80 echo '<p>'; 81 echo $this->build_checkbox( $random_order, $random_order_field_id, $random_order_field_name, 'Display in random order?', 'no' ); 82 echo '</p>'; 83 75 $sort_order = $instance['sort_order']; 76 $sort_order_field_id = $this->get_field_id('sort_order'); 77 $sort_order_field_name = $this->get_field_name('sort_order'); 78 $sort_order_value = attribute_escape( $sort_order ); 79 80 ?> 81 <p> 82 <label>Sort order:</label> 83 <select name="<?php echo $sort_order_field_name; ?>" id="<?php echo $sort_order_field_id; ?>"> 84 <option value="ASC" <?php selected( $sort_order_value, 'ASC' ); ?>>Ascending</option> 85 <option value="DESC" <?php selected( $sort_order_value, 'DESC' ); ?>>Descending</option> 86 <option value="rand" <?php selected( $sort_order_value, 'rand' ); ?>>Random</option> 87 </select> 88 </p> 89 <?php 84 90 85 91 // Show as hyperlink … … 124 130 $instance['title'] = $new_instance['title']; 125 131 $instance['posts_per_page'] = $new_instance['posts_per_page']; 126 $instance['random_order'] = $new_instance['random_order'];127 132 $instance['display_as_link'] = $new_instance['display_as_link']; 128 133 $instance['include_drafts'] = $new_instance['include_drafts']; 129 134 $instance['include_only_drafts'] = $new_instance['include_only_drafts']; 135 $instance['sort_order'] = $new_instance['sort_order']; 130 136 131 137 return $instance; … … 164 170 } 165 171 166 if ( !empty( $instance['random_order'] ) && 'on' == $instance['random_order'] ) { 167 $qry_args['orderby'] = 'rand'; 172 if ( !empty( $instance['sort_order'] ) ) { 173 switch ( $instance['sort_order'] ) { 174 case 'DESC': 175 echo 'desc'; 176 $qry_args['order'] = 'DESC'; 177 $qry_args['orderby'] = 'date'; 178 break; 179 case 'rand': 180 echo 'rand'; 181 $qry_args['orderby'] = 'rand'; 182 break; 183 default: 184 echo 'default'; 185 $qry_args['order'] = 'ASC'; 186 $qry_args['orderby'] = 'date'; 187 } 168 188 } 169 189 … … 248 268 extract( shortcode_atts( array( 249 269 'numposts' => '', 250 ' random' => 'no',270 'sortorder' => 'asc', 251 271 'showmore' => 'yes', 252 272 'showlink' => 'no', … … 286 306 } 287 307 288 if ( !empty( $random ) && 'yes' == $random ) { 289 $qry_args['orderby'] = 'rand'; 308 if ( !empty( $sortorder ) ) { 309 switch ( strtolower( $sortorder ) ) { 310 case 'desc': 311 $qry_args['order'] = 'DESC'; 312 $qry_args['orderby'] = 'date'; 313 break; 314 case 'rand': 315 $qry_args['orderby'] = 'rand'; 316 break; 317 default: 318 $qry_args['order'] = 'ASC'; 319 $qry_args['orderby'] = 'date'; 320 } 290 321 } 291 322 -
bcd-upcoming-posts/trunk/readme.txt
r638017 r659919 4 4 Tags: post,future,upcoming,widget 5 5 Requires at least: 3.4.2 6 Tested up to: 3.5. 07 Stable tag: 1. 3.06 Tested up to: 3.5.1 7 Stable tag: 1.4.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 18 18 19 19 * Control number of posts to be displayed 20 * Display posts in random order20 * Display posts in ascending, descending or random order 21 21 * Display post titles as a link or plain text 22 22 * Display drafts along with scheduled posts … … 49 49 == Changelog == 50 50 51 = 1.4.0 = 52 * Changed random order option to be a sort order to choose ascending, descending or random order 53 * Fixed an issue with the enabling/disabling of the include only drafts option 54 51 55 = 1.3.0 = 52 56 * Added a new option to the widget to choose whether or not to display drafts along with scheduled posts … … 71 75 == Upgrade Notice == 72 76 77 = 1.4.0 = 78 * Changes random order option to be a sort order to choose ascending, descending or random order 79 * Fixes an issue with the enabling/disabling of the include only drafts option 80 73 81 = 1.3.0 = 74 * Add eda new option to the widget to choose whether or not to display drafts along with scheduled posts75 * Add eda new option to the widget to choose whether or not to display drafts instead of scheduled posts76 * Add eda new option to the shortcode to choose whether or not to display drafts along with scheduled posts77 * Add eda new option to the shortcode to choose whether or not to display drafts instead of scheduled posts82 * Adds a new option to the widget to choose whether or not to display drafts along with scheduled posts 83 * Adds a new option to the widget to choose whether or not to display drafts instead of scheduled posts 84 * Adds a new option to the shortcode to choose whether or not to display drafts along with scheduled posts 85 * Adds a new option to the shortcode to choose whether or not to display drafts instead of scheduled posts 78 86 79 87 = 1.2.0 = -
bcd-upcoming-posts/trunk/scripts/bcdup-script.js
r637859 r659919 1 1 jQuery(document).ready(function($) { 2 $(' #widget-bcd_upcoming_posts-3-include_drafts').click(function () {3 var include_only_drafts = $(' #widget-bcd_upcoming_posts-3-include_only_drafts');4 var include_only_drafts_label = $(' #widget-bcd_upcoming_posts-3-include_only_drafts_label');2 $('input:checkbox[id*=include_drafts]').click(function () { 3 var include_only_drafts = $('input:checkbox[id*=include_only_drafts]'); 4 var include_only_drafts_label = $('label[id*=include_only_drafts_label]'); 5 5 6 6 if ( $(this).is(':checked') ) { … … 14 14 15 15 $('.widgets-sortables').ajaxSuccess(function() { 16 $(' #widget-bcd_upcoming_posts-3-include_drafts').click(function () {17 var include_only_drafts = $(' #widget-bcd_upcoming_posts-3-include_only_drafts');18 var include_only_drafts_label = $(' #widget-bcd_upcoming_posts-3-include_only_drafts_label');16 $('input:checkbox[id*=include_drafts]').click(function () { 17 var include_only_drafts = $('input:checkbox[id*=include_only_drafts]'); 18 var include_only_drafts_label = $('label[id*=include_only_drafts_label]'); 19 19 20 20 if ( $(this).is(':checked') ) {
Note: See TracChangeset
for help on using the changeset viewer.