Changeset 1160273
- Timestamp:
- 05/14/2015 09:18:02 AM (11 years ago)
- Location:
- advanced-recent-posts/trunk
- Files:
-
- 4 edited
-
backend/lptw-recent-posts-backend.php (modified) (1 diff)
-
backend/lptw-recent-posts-shortcode-builder.js (modified) (1 diff)
-
lptw-recent-posts.php (modified) (11 diffs)
-
readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
advanced-recent-posts/trunk/backend/lptw-recent-posts-backend.php
r1158067 r1160273 31 31 </ul> 32 32 </fieldset> 33 </td> 34 </tr> 35 <tr id="post_types"> 36 <th scope="row"><label for="post_type">Post type:</label></th> 37 <td> 38 <select id="post_type" name="post_type"> 39 <?php 40 $post_types = get_post_types( '', 'names' ); 41 foreach ( $post_types as $post_type ) { 42 echo '<option value="' . $post_type . '">' . $post_type . '</option>'; 43 } 44 ?> 45 </select> 33 46 </td> 34 47 </tr> -
advanced-recent-posts/trunk/backend/lptw-recent-posts-shortcode-builder.js
r1158067 r1160273 1 1 jQuery(document).ready(function($) { 2 'use strict'; 3 /* widget scripts */ 4 5 $('body').on('click', '.lptw-categories-dropdown-link', function(e) { 6 e.preventDefault(); 7 var $parent = $(this).closest('div[id]'); 8 $parent.find('#lptw-categories-wrapper').slideToggle('fast'); 9 $parent.find('#lptw-categories-action').toggleClass( 'lptw-categories-action-down' ); 10 $parent.find('#lptw-categories-action').toggleClass( 'lptw-categories-action-up' ); 11 }); 12 13 /* shortcode builder scripts */ 14 15 $("#lptw_generate_shortcode").click(function(e) { 16 var sb_layout = $('input[name="sb_layout"]:checked', '#layout-types').val(); 17 18 var post_category_selected = []; 19 $('#categories_list input:checked').each(function() { 20 post_category_selected.push($(this).attr('value')); 21 }); 22 var sb_category_id = post_category_selected.toString(); 23 24 if ($("#sb_fluid_images").is(":checked") == true) { 25 var sb_fluid_images = "true"; 26 var sb_width = ""; 27 var sb_columns = ""; 28 } else { 29 var sb_fluid_images = "false"; 30 var sb_width = $("#sb_width").val(); 31 var sb_columns = $('input[name="sb_columns"]:checked', '#columns_count').val(); 32 } 33 34 var sb_posts_per_page = $("#posts_per_page").val(); 35 36 if ($("#reverse_post_order").is(":checked") == true) { 37 var sb_reverse_post_order = "true"; 38 } else { 39 var sb_reverse_post_order = "false"; 40 } 41 42 var sb_thumbnail_size = $("#thumbnail_size").val(); 43 var sb_color_scheme = $("#color_scheme").val(); 44 45 if ($("#show_date_before_title").is(":checked") == true) { 46 var sb_show_date_before_title = "true"; 47 } else { 48 var sb_show_date_before_title = "false"; 49 } 50 51 if ($("#show_date").is(":checked") == true) { 52 var sb_show_date = "true"; 53 } else { 54 var sb_show_date = "false"; 55 } 56 57 if ($("#show_time").is(":checked") == true) { 58 var sb_show_time = "true"; 59 } else { 60 var sb_show_time = "false"; 61 } 62 63 if ($("#show_time_before").is(":checked") == true) { 64 var sb_show_time_before = "true"; 65 } else { 66 var sb_show_time_before = "false"; 67 } 68 69 var sb_date_format = $('input[name="sb_date_format"]:checked', '#date_formats').val(); 70 var sb_time_format = $('input[name="sb_time_format"]:checked', '#time_formats').val(); 71 72 /* clear unused options depending on layout */ 73 74 /* basic layout */ 75 76 /* thumbnail layout */ 77 if (sb_layout == 'thumbnail') { 78 sb_fluid_images = ''; 79 sb_thumbnail_size = ''; 80 sb_color_scheme = ''; 81 } 82 83 /* dropcap layout */ 84 if (sb_layout == 'dropcap') { 85 sb_show_date = ''; 86 sb_fluid_images = ''; 87 sb_thumbnail_size = ''; 88 sb_color_scheme = ''; 89 sb_date_format = ''; 90 sb_time_format = ''; 91 sb_show_time = ''; 92 sb_show_time_before = ''; 93 sb_show_date_before_title = ''; 94 } 95 96 /* responsive grid layout */ 97 if (sb_layout == 'grid-medium') { 98 sb_fluid_images = ''; 99 sb_thumbnail_size = ''; 100 sb_width = ''; 101 sb_columns = ''; 102 } 103 104 105 var shortcode = '[lptw_recentposts'; 106 if (sb_layout != '') { 107 shortcode += ' layout="' + sb_layout + '"'; 108 } 109 if (sb_category_id != '') { 110 shortcode += ' category_id="' + sb_category_id + '"'; 111 } 112 if (sb_fluid_images != "") { 113 shortcode += ' fluid_images="' + sb_fluid_images + '"'; 114 } 115 if (sb_width != '') { 116 shortcode += ' width="' + sb_width + '"'; 117 } 118 if (sb_columns != '') { 119 shortcode += ' columns="' + sb_columns + '"'; 120 } 121 if (sb_posts_per_page != '') { 122 shortcode += ' posts_per_page="' + sb_posts_per_page + '"'; 123 } 124 if (sb_reverse_post_order != '') { 125 shortcode += ' reverse_post_order="' + sb_reverse_post_order + '"'; 126 } 127 if (sb_thumbnail_size != '') { 128 shortcode += ' thumbnail_size="' + sb_thumbnail_size + '"'; 129 } 130 if (sb_color_scheme != '') { 131 shortcode += ' color_scheme="' + sb_color_scheme + '"'; 132 } 133 if (sb_show_date_before_title != '') { 134 shortcode += ' show_date_before_title="' + sb_show_date_before_title + '"'; 135 } 136 if (sb_show_date != '') { 137 shortcode += ' show_date="' + sb_show_date + '"'; 138 } 139 if (sb_show_time != '') { 140 shortcode += ' show_time="' + sb_show_time + '"'; 141 } 142 if (sb_show_time_before != '') { 143 shortcode += ' show_time_before="' + sb_show_time_before + '"'; 144 } 145 if (sb_date_format != '') { 146 shortcode += ' date_format="' + sb_date_format + '"'; 147 } 148 if (sb_time_format != '') { 149 shortcode += ' time_format="' + sb_time_format + '"'; 150 } 151 shortcode += ']'; 152 153 $('#lptw_generate_shortcode_result').val(shortcode).addClass('ready'); 154 e.preventDefault(); 155 }); 156 157 /* disable/enable inputs */ 158 159 $('#sb_fluid_images').change(function() { 160 $('#sb_width').prop('disabled', function(i, v) { 161 return !v; 162 }); 163 $('#sb_columns_1').prop('disabled', function(i, v) { 164 return !v; 165 }); 166 $('#sb_columns_2').prop('disabled', function(i, v) { 167 return !v; 168 }); 169 }); 170 171 $(".layout-radio").change(function() { 172 173 if ($("#layout-basic").is(":checked") == true) { 174 /* disable all inputs with class layout-basic-hide */ 175 $('.layout-basic-hide').prop('disabled', true); 176 177 /* enable all inputs with class layout-basic-show */ 178 $('.layout-basic-show').prop('disabled', false); 179 180 $('#sb_fluid_images').prop('checked', true); 181 } 182 183 if ($("#layout-thumbnail").is(":checked") == true) { 184 /* disable all inputs with class layout-thumbnail-hide */ 185 $('.layout-thumbnail-hide').prop('disabled', true); 186 187 /* enable all inputs with class layout-thumbnail-show */ 188 $('.layout-thumbnail-show').prop('disabled', false); 189 190 $('#sb_fluid_images').prop('checked', false); 191 } 192 193 if ($("#layout-dropcap").is(":checked") == true) { 194 /* disable all inputs with class layout-dropcap-hide */ 195 $('.layout-dropcap-hide').prop('disabled', true); 196 197 /* enable all inputs with class layout-dropcap-show */ 198 $('.layout-dropcap-show').prop('disabled', false); 199 200 $('#sb_fluid_images').prop('checked', false); 201 } 202 203 if ($("#layout-grid-medium").is(":checked") == true) { 204 /* disable all inputs with class layout-basic-hide */ 205 $('.layout-grid-hide').prop('disabled', true); 206 207 /* enable all inputs with class layout-basic-show */ 208 $('.layout-grid-show').prop('disabled', false); 209 210 $('#sb_fluid_images').prop('checked', false); 211 } 212 213 }); 2 'use strict'; 3 /* widget scripts */ 4 5 $('body').on('click', '.lptw-categories-dropdown-link', function(e) { 6 e.preventDefault(); 7 var $parent = $(this).closest('div[id]'); 8 $parent.find('#lptw-categories-wrapper').slideToggle('fast'); 9 $parent.find('#lptw-categories-action').toggleClass('lptw-categories-action-down'); 10 $parent.find('#lptw-categories-action').toggleClass('lptw-categories-action-up'); 11 }); 12 13 /* shortcode builder scripts */ 14 15 $("#lptw_generate_shortcode").click(function(e) { 16 var sb_layout = $('input[name="sb_layout"]:checked', '#layout-types').val(); 17 18 var sb_post_type = $("#post_type").val(); 19 20 var post_category_selected = []; 21 $('#categories_list input:checked').each(function() { 22 post_category_selected.push($(this).attr('value')); 23 }); 24 var sb_category_id = post_category_selected.toString(); 25 26 if ($("#sb_fluid_images").is(":checked") == true) { 27 var sb_fluid_images = "true"; 28 var sb_width = ""; 29 var sb_columns = ""; 30 } else { 31 var sb_fluid_images = "false"; 32 var sb_width = $("#sb_width").val(); 33 var sb_columns = $('input[name="sb_columns"]:checked', '#columns_count').val(); 34 } 35 36 var sb_posts_per_page = $("#posts_per_page").val(); 37 38 if ($("#reverse_post_order").is(":checked") == true) { 39 var sb_reverse_post_order = "true"; 40 } else { 41 var sb_reverse_post_order = "false"; 42 } 43 44 var sb_thumbnail_size = $("#thumbnail_size").val(); 45 var sb_color_scheme = $("#color_scheme").val(); 46 47 if ($("#show_date_before_title").is(":checked") == true) { 48 var sb_show_date_before_title = "true"; 49 } else { 50 var sb_show_date_before_title = "false"; 51 } 52 53 if ($("#show_date").is(":checked") == true) { 54 var sb_show_date = "true"; 55 } else { 56 var sb_show_date = "false"; 57 } 58 59 if ($("#show_time").is(":checked") == true) { 60 var sb_show_time = "true"; 61 } else { 62 var sb_show_time = "false"; 63 } 64 65 if ($("#show_time_before").is(":checked") == true) { 66 var sb_show_time_before = "true"; 67 } else { 68 var sb_show_time_before = "false"; 69 } 70 71 var sb_date_format = $('input[name="sb_date_format"]:checked', '#date_formats').val(); 72 var sb_time_format = $('input[name="sb_time_format"]:checked', '#time_formats').val(); 73 74 /* clear unused options depending on layout */ 75 76 /* basic layout */ 77 78 /* thumbnail layout */ 79 if (sb_layout == 'thumbnail') { 80 sb_fluid_images = ''; 81 sb_thumbnail_size = ''; 82 sb_color_scheme = ''; 83 } 84 85 /* dropcap layout */ 86 if (sb_layout == 'dropcap') { 87 sb_show_date = ''; 88 sb_fluid_images = ''; 89 sb_thumbnail_size = ''; 90 sb_color_scheme = ''; 91 sb_date_format = ''; 92 sb_time_format = ''; 93 sb_show_time = ''; 94 sb_show_time_before = ''; 95 sb_show_date_before_title = ''; 96 } 97 98 /* responsive grid layout */ 99 if (sb_layout == 'grid-medium') { 100 sb_fluid_images = ''; 101 sb_thumbnail_size = ''; 102 sb_width = ''; 103 sb_columns = ''; 104 } 105 106 107 var shortcode = '[lptw_recentposts'; 108 if (sb_layout != '') { 109 shortcode += ' layout="' + sb_layout + '"'; 110 } 111 if (sb_post_type != '') { 112 shortcode += ' post_type="' + sb_post_type + '"'; 113 } 114 if (sb_category_id != '') { 115 shortcode += ' category_id="' + sb_category_id + '"'; 116 } 117 if (sb_fluid_images != "") { 118 shortcode += ' fluid_images="' + sb_fluid_images + '"'; 119 } 120 if (sb_width != '') { 121 shortcode += ' width="' + sb_width + '"'; 122 } 123 if (sb_columns != '') { 124 shortcode += ' columns="' + sb_columns + '"'; 125 } 126 if (sb_posts_per_page != '') { 127 shortcode += ' posts_per_page="' + sb_posts_per_page + '"'; 128 } 129 if (sb_reverse_post_order != '') { 130 shortcode += ' reverse_post_order="' + sb_reverse_post_order + '"'; 131 } 132 if (sb_thumbnail_size != '') { 133 shortcode += ' thumbnail_size="' + sb_thumbnail_size + '"'; 134 } 135 if (sb_color_scheme != '') { 136 shortcode += ' color_scheme="' + sb_color_scheme + '"'; 137 } 138 if (sb_show_date_before_title != '') { 139 shortcode += ' show_date_before_title="' + sb_show_date_before_title + '"'; 140 } 141 if (sb_show_date != '') { 142 shortcode += ' show_date="' + sb_show_date + '"'; 143 } 144 if (sb_show_time != '') { 145 shortcode += ' show_time="' + sb_show_time + '"'; 146 } 147 if (sb_show_time_before != '') { 148 shortcode += ' show_time_before="' + sb_show_time_before + '"'; 149 } 150 if (sb_date_format != '') { 151 shortcode += ' date_format="' + sb_date_format + '"'; 152 } 153 if (sb_time_format != '') { 154 shortcode += ' time_format="' + sb_time_format + '"'; 155 } 156 shortcode += ']'; 157 158 $('#lptw_generate_shortcode_result').val(shortcode).addClass('ready'); 159 e.preventDefault(); 160 }); 161 162 /* disable/enable inputs */ 163 164 $('#sb_fluid_images').change(function() { 165 $('#sb_width').prop('disabled', function(i, v) { 166 return !v; 167 }); 168 $('#sb_columns_1').prop('disabled', function(i, v) { 169 return !v; 170 }); 171 $('#sb_columns_2').prop('disabled', function(i, v) { 172 return !v; 173 }); 174 }); 175 176 $(".layout-radio").change(function() { 177 178 if ($("#layout-basic").is(":checked") == true) { 179 /* disable all inputs with class layout-basic-hide */ 180 $('.layout-basic-hide').prop('disabled', true); 181 182 /* enable all inputs with class layout-basic-show */ 183 $('.layout-basic-show').prop('disabled', false); 184 185 $('#sb_fluid_images').prop('checked', true); 186 } 187 188 if ($("#layout-thumbnail").is(":checked") == true) { 189 /* disable all inputs with class layout-thumbnail-hide */ 190 $('.layout-thumbnail-hide').prop('disabled', true); 191 192 /* enable all inputs with class layout-thumbnail-show */ 193 $('.layout-thumbnail-show').prop('disabled', false); 194 195 $('#sb_fluid_images').prop('checked', false); 196 } 197 198 if ($("#layout-dropcap").is(":checked") == true) { 199 /* disable all inputs with class layout-dropcap-hide */ 200 $('.layout-dropcap-hide').prop('disabled', true); 201 202 /* enable all inputs with class layout-dropcap-show */ 203 $('.layout-dropcap-show').prop('disabled', false); 204 205 $('#sb_fluid_images').prop('checked', false); 206 } 207 208 if ($("#layout-grid-medium").is(":checked") == true) { 209 /* disable all inputs with class layout-basic-hide */ 210 $('.layout-grid-hide').prop('disabled', true); 211 212 /* enable all inputs with class layout-basic-show */ 213 $('.layout-grid-show').prop('disabled', false); 214 215 $('#sb_fluid_images').prop('checked', false); 216 } 217 218 }); 214 219 215 220 -
advanced-recent-posts/trunk/lptw-recent-posts.php
r1158510 r1160273 4 4 Plugin URI: http://lp-tricks.com/ 5 5 Description: Plugin that shows the recent posts with thumbnails in the widget and in other parts of the your blog or theme with shortcodes. 6 Tags: widget, posts, plugin, recent, recent posts, latest, latest posts, shortcode, thumbnail, thumbnails, categories, content, featured image, Taxonomy 7 Version: 0.6. 16 Tags: widget, posts, plugin, recent, recent posts, latest, latest posts, shortcode, thumbnail, thumbnails, categories, content, featured image, Taxonomy, custom post type, custom 7 Version: 0.6.2 8 8 Author: Eugene Holin 9 9 Author URI: http://lp-tricks.com/ … … 189 189 $post_category = isset( $instance['post_category'] ) ? $instance['post_category'] : array(); 190 190 191 $post_type = isset( $instance['post_type'] ) ? $instance['post_type'] : 'post'; 192 191 193 /* don't show post in recent if it shows in page */ 192 194 global $post; … … 194 196 195 197 $r = new WP_Query( apply_filters( 'widget_posts_args', array( 198 'post_type' => $post_type, 196 199 'posts_per_page' => $number, 197 200 'no_found_rows' => true, … … 318 321 if ( isset( $instance[ 'post_category' ] ) ) { $post_category = $instance[ 'post_category' ]; } 319 322 323 if ( isset( $instance[ 'post_type' ] ) ) { $post_type = $instance[ 'post_type' ]; } 324 else { $post_type = 'post_type'; } 325 320 326 // Widget admin form 321 327 ?> … … 326 332 <p><input class="checkbox" type="checkbox" <?php checked( $show_widget_title ); ?> id="<?php echo $this->get_field_id( 'show_widget_title' ); ?>" name="<?php echo $this->get_field_name( 'show_widget_title' ); ?>" /> 327 333 <label for="<?php echo $this->get_field_id( 'show_widget_title' ); ?>"><?php _e( 'Display widget title?', 'lptw_recent_posts_domain' ); ?></label></p> 334 335 <p> 336 <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e( 'Post type:', 'lptw_recent_posts_domain' ); ?></label> 337 <select name="<?php echo $this->get_field_name( 'post_type' ); ?>" id="<?php echo $this->get_field_id('post_type'); ?>" class="widefat"> 338 <?php 339 $post_types = get_post_types( '', 'names' ); 340 foreach ( $post_types as $registered_post_type ) { 341 echo '<option value="' . $registered_post_type . '"'.selected( $post_type, $registered_post_type ).'>' . $registered_post_type . '</option>'; 342 } 343 ?> 344 </select> 345 </p> 328 346 329 347 <div class="lptw-categories-dropdown"><a class="lptw-categories-dropdown-link" href="#">List of categories <span id="lptw-categories-action" class="lptw-categories-action-down"></span></a></div> … … 418 436 } else { $instance['post_category'] = ''; } 419 437 438 $instance['post_type'] = strip_tags($new_instance['post_type']); 439 420 440 $this->flush_widget_cache(); 421 441 … … 504 524 $post_category = isset( $instance['post_category'] ) ? $instance['post_category'] : array(); 505 525 526 $post_type = isset( $instance['post_type'] ) ? $instance['post_type'] : 'post'; 527 506 528 /* don't show post in recent if it shows in page */ 507 529 global $post; … … 509 531 510 532 $r = new WP_Query( apply_filters( 'widget_posts_args', array( 533 'post_type' => $post_type, 511 534 'posts_per_page' => $number, 512 535 'no_found_rows' => true, … … 617 640 if ( isset( $instance[ 'post_category' ] ) ) { $post_category = $instance[ 'post_category' ]; } 618 641 642 if ( isset( $instance[ 'post_type' ] ) ) { $post_type = $instance[ 'post_type' ]; } 643 else { $post_type = 'post_type'; } 644 619 645 // Widget admin form 620 646 ?> … … 625 651 <p><input class="checkbox" type="checkbox" <?php checked( $show_widget_title ); ?> id="<?php echo $this->get_field_id( 'show_widget_title' ); ?>" name="<?php echo $this->get_field_name( 'show_widget_title' ); ?>" /> 626 652 <label for="<?php echo $this->get_field_id( 'show_widget_title' ); ?>"><?php _e( 'Display widget title?', 'lptw_recent_posts_domain' ); ?></label></p> 653 654 <p> 655 <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e( 'Post type:', 'lptw_recent_posts_domain' ); ?></label> 656 <select name="<?php echo $this->get_field_name( 'post_type' ); ?>" id="<?php echo $this->get_field_id('post_type'); ?>" class="widefat"> 657 <?php 658 $post_types = get_post_types( '', 'names' ); 659 foreach ( $post_types as $registered_post_type ) { 660 echo '<option value="' . $registered_post_type . '"'.selected( $post_type, $registered_post_type ).'>' . $registered_post_type . '</option>'; 661 } 662 ?> 663 </select> 664 </p> 627 665 628 666 <div class="lptw-categories-dropdown"><a class="lptw-categories-dropdown-link" href="#">List of categories <span id="lptw-categories-action" class="lptw-categories-action-down"></span></a></div> … … 707 745 $instance['post_category'] = $terms; 708 746 } else { $instance['post_category'] = ''; } 747 748 $instance['post_type'] = strip_tags($new_instance['post_type']); 709 749 710 750 $this->flush_widget_cache(); -
advanced-recent-posts/trunk/readme.txt
r1158513 r1160273 1 1 === Plugin Name === 2 2 Contributors: eugenyh 3 Tags: widget, posts, plugin, recent, recent posts, latest, latest posts, shortcode, thumbnail, thumbnails, categories, content, featured image, Taxonomy 3 Tags: widget, posts, plugin, recent, recent posts, latest, latest posts, shortcode, thumbnail, thumbnails, categories, content, featured image, Taxonomy, custom post type, custom 4 4 Requires at least: 3.0.1 5 5 Tested up to: 4.2.2 6 Stable tag: 0.6. 16 Stable tag: 0.6.2 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 33 33 Better to see once than read a hundred times - see the [live demo](http://demo.lp-tricks.com/) on my website :) 34 34 35 Like my plugin? Please, rate :) ★★★★★ 36 35 37 **Contributing** 36 38 … … 43 45 == Installation == 44 46 45 1. Upload " lptw-recent-posts" folder to the "/wp-content/plugins/" directory47 1. Upload "advanced-recent-posts" folder to the "/wp-content/plugins/" directory 46 48 1. Activate the plugin through the Plugins menu into WordPress admin area 47 49 1. Use plugin shortcode builder to create a shortcode and use it a in your posts … … 58 60 59 61 == Changelog == 62 63 = 0.6.2 = 64 * Added Custom Post Types support 60 65 61 66 = 0.6.1 =
Note: See TracChangeset
for help on using the changeset viewer.