List category posts - Version 0.19.1

Version Description

  • Added thumbnail to Widget.
  • Added thumbnail link to post (http://picod.net/33).
Download this release

Release Info

Developer fernandobt
Plugin Icon 128x128 List category posts
Version 0.19.1
Comparing to
See all releases

Code changes from version 0.19 to 0.19.1

include/CatList.php CHANGED
@@ -205,7 +205,7 @@ class CatList{
205
  if ($this->params['thumbnail']=='yes'){
206
  $lcp_thumbnail = '';
207
  if ( has_post_thumbnail($single->ID) ) {
208
- $lcp_thumbnail = get_the_post_thumbnail($single->ID, $this->params['thumbnail_size']);
209
  }
210
  return $lcp_thumbnail;
211
  } else {
205
  if ($this->params['thumbnail']=='yes'){
206
  $lcp_thumbnail = '';
207
  if ( has_post_thumbnail($single->ID) ) {
208
+ $lcp_thumbnail = '<a href="' . get_permalink($single->ID).'">' . get_the_post_thumbnail($single->ID, $this->params['thumbnail_size']) . '</a>';
209
  }
210
  return $lcp_thumbnail;
211
  } else {
include/ListCategoryPostsWidget.php CHANGED
@@ -28,38 +28,44 @@ class ListCategoryPostsWidget extends WP_Widget{
28
  function widget($args, $instance) {
29
  extract( $args );
30
  $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
31
- $limit = (is_numeric($instance['limit'])) ? $instance['limit'] : 5;
32
- $orderby = ($instance['orderby']) ? $instance['orderby'] : 'date';
33
- $order = ($instance['order']) ? $instance['order'] : 'desc';
34
- $exclude = ($instance['exclude'] != '') ? $instance['exclude'] : 0;
35
- $excludeposts = ($instance['excludeposts'] != '') ? $instance['excludeposts'] : 0;
36
- $offset = (is_numeric($instance['offset'])) ? $instance['offset'] : 0;
37
  $category_id = $instance['categoryid'];
38
  $dateformat = ($instance['dateformat']) ? $instance['dateformat'] : get_option('date_format');
39
  $showdate = ($instance['show_date'] == 'on') ? 'yes' : 'no';
40
  $showexcerpt = ($instance['show_excerpt'] == 'on') ? 'yes' : 'no';
41
  $showauthor = ($instance['show_author'] == 'on') ? 'yes' : 'no';
42
  $showcatlink = ($instance['show_catlink'] == 'on') ? 'yes' : 'no';
 
 
43
 
44
  echo $before_widget;
45
  echo $before_title . $title . $after_title;
 
46
  $atts = array(
47
- 'id' => $category_id,
48
- 'orderby' => $orderby,
49
- 'order' => $order,
50
- 'numberposts' => $limit,
51
- 'date' => $showdate,
52
- 'author' => $showauthor,
53
- 'dateformat' => $dateformat,
54
- 'template' => 'default',
55
- 'excerpt' => $showexcerpt,
56
- 'exclude' => $exclude,
57
- 'excludeposts' => $excludeposts,
58
- 'offset' => $offset,
59
- //'tags' => '',
60
- //'content' => 'no',
61
- 'catlink' => $showcatlink
62
- );
 
 
 
63
  $catlist_displayer = new CatListDisplayer($atts);
64
  echo $catlist_displayer->display();
65
  echo $lcp_result;
@@ -82,6 +88,9 @@ class ListCategoryPostsWidget extends WP_Widget{
82
  $instance['show_excerpt'] = strip_tags($new_instance['show_excerpt']);
83
  $instance['show_author'] = strip_tags($new_instance['show_author']);
84
  $instance['show_catlink'] = strip_tags($new_instance['show_catlink']);
 
 
 
85
 
86
  return $instance;
87
  }
28
  function widget($args, $instance) {
29
  extract( $args );
30
  $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
31
+ $limit = (is_numeric($instance['limit'])) ? $instance['limit'] : 5;
32
+ $orderby = ($instance['orderby']) ? $instance['orderby'] : 'date';
33
+ $order = ($instance['order']) ? $instance['order'] : 'desc';
34
+ $exclude = ($instance['exclude'] != '') ? $instance['exclude'] : 0;
35
+ $excludeposts = ($instance['excludeposts'] != '') ? $instance['excludeposts'] : 0;
36
+ $offset = (is_numeric($instance['offset'])) ? $instance['offset'] : 0;
37
  $category_id = $instance['categoryid'];
38
  $dateformat = ($instance['dateformat']) ? $instance['dateformat'] : get_option('date_format');
39
  $showdate = ($instance['show_date'] == 'on') ? 'yes' : 'no';
40
  $showexcerpt = ($instance['show_excerpt'] == 'on') ? 'yes' : 'no';
41
  $showauthor = ($instance['show_author'] == 'on') ? 'yes' : 'no';
42
  $showcatlink = ($instance['show_catlink'] == 'on') ? 'yes' : 'no';
43
+ $thumbnail = ($instance['thumbnail'] == 'on') ? 'yes' : 'no';
44
+ $thumbnail_size = ($instance['thumbnail_size']) ? $instance['thumbnail_size'] : 'thumbnail';
45
 
46
  echo $before_widget;
47
  echo $before_title . $title . $after_title;
48
+
49
  $atts = array(
50
+ 'id' => $category_id,
51
+ 'orderby' => $orderby,
52
+ 'order' => $order,
53
+ 'numberposts' => $limit,
54
+ 'date' => $showdate,
55
+ 'author' => $showauthor,
56
+ 'dateformat' => $dateformat,
57
+ 'template' => 'default',
58
+ 'excerpt' => $showexcerpt,
59
+ 'exclude' => $exclude,
60
+ 'excludeposts' => $excludeposts,
61
+ 'offset' => $offset,
62
+ //'tags' => '',
63
+ //'content' => 'no',
64
+ 'catlink' => $showcatlink,
65
+ 'thumbnail' => $thumbnail,
66
+ 'thumbnail_size' => $thumbnail_size
67
+ );
68
+
69
  $catlist_displayer = new CatListDisplayer($atts);
70
  echo $catlist_displayer->display();
71
  echo $lcp_result;
88
  $instance['show_excerpt'] = strip_tags($new_instance['show_excerpt']);
89
  $instance['show_author'] = strip_tags($new_instance['show_author']);
90
  $instance['show_catlink'] = strip_tags($new_instance['show_catlink']);
91
+ $instance['show_catlink'] = strip_tags($new_instance['show_catlink']);
92
+ $instance['thumbnail'] = strip_tags($new_instance['thumbnail']);
93
+ $instance['thumbnail_size'] = strip_tags($new_instance['thumbnail_size']);
94
 
95
  return $instance;
96
  }
include/lcp_widget_form.php CHANGED
@@ -27,6 +27,7 @@ $instance = wp_parse_args( (array) $instance, array(
27
  'show_excerpt'=>'',
28
  'exclude'=>'',
29
  'excludeposts'=>'',
 
30
  'offset'=>'',
31
  'show_catlink'=>'' ) );
32
  $title = strip_tags($instance['title']);
@@ -41,7 +42,8 @@ $offset = strip_tags($instance['offset']);
41
  $showcatlink = strip_tags($instance['catlink']);
42
  $categoryid = strip_tags($instance['categoryid']);
43
  $showexcerpt = strip_tags($instance['excerpt']);
44
- //var_dump($instance);
 
45
  ?>
46
 
47
  <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e("Title")?></label>
@@ -112,23 +114,33 @@ $showexcerpt = strip_tags($instance['excerpt']);
112
  value="<?php echo attribute_escape($excludeposts); ?>" />
113
  </p>
114
 
115
- <p>
116
  <label>Show: </label><br/>
117
- <p>
118
- <input type="checkbox"
119
- <?php checked( (bool) $instance['show_date'], true ); ?>
120
- name="<?php echo $this->get_field_name( 'show_date' ); ?>" />Date
121
- </p><p>
122
- <input type="checkbox"
123
- <?php checked( (bool) $instance['show_author'], true ); ?>
124
- name="<?php echo $this->get_field_name( 'show_author' ); ?>" />Author
125
- </p><p>
126
- <input type="checkbox"
127
- <?php checked( (bool) $instance['show_catlink'], true ); ?>
128
- name="<?php echo $this->get_field_name( 'show_catlink' ); ?>" />Link to category
129
- </p><p>
130
- <input type="checkbox"
131
- <?php checked( (bool) $instance['show_excerpt'], true ); ?>
132
- name="<?php echo $this->get_field_name( 'show_excerpt' ); ?>" />Excerpt
133
- </p>
134
- </p>
 
 
 
 
 
 
 
 
 
 
27
  'show_excerpt'=>'',
28
  'exclude'=>'',
29
  'excludeposts'=>'',
30
+ 'thumbnail' =>'',
31
  'offset'=>'',
32
  'show_catlink'=>'' ) );
33
  $title = strip_tags($instance['title']);
42
  $showcatlink = strip_tags($instance['catlink']);
43
  $categoryid = strip_tags($instance['categoryid']);
44
  $showexcerpt = strip_tags($instance['excerpt']);
45
+ $thumbnail = strip_tags($instance['thumbnail']);
46
+ $thumbnail_size = strip_tags($instance['thumbnail_size']);
47
  ?>
48
 
49
  <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e("Title")?></label>
114
  value="<?php echo attribute_escape($excludeposts); ?>" />
115
  </p>
116
 
117
+
118
  <label>Show: </label><br/>
119
+ <p>
120
+ <input type="checkbox" <?php checked( (bool) $instance['thumbnail'], true ); ?>
121
+ name="<?php echo $this->get_field_name( 'thumbnail'); ?>" />Thumbnail - size:
122
+ <select id="<?php echo $this->get_field_id('thumbnail_size'); ?>"
123
+ name="<?php echo $this->get_field_name( 'thumbnail_size' ); ?>" type="text">
124
+ <option value='thumbnail'>thumbnail</option>
125
+ <option value='medium'>medium</option>
126
+ <option value='large'>large</option>
127
+ <option value='full'>full</option>
128
+ </select>
129
+ </p>
130
+ <p>
131
+ <input type="checkbox" <?php checked( (bool) $instance['show_date'], true ); ?>
132
+ name="<?php echo $this->get_field_name( 'show_date' ); ?>" />Date
133
+ </p>
134
+ <p>
135
+ <input type="checkbox" <?php checked( (bool) $instance['show_author'], true ); ?>
136
+ name="<?php echo $this->get_field_name( 'show_author' ); ?>" />Author
137
+ </p>
138
+ <p>
139
+ <input type="checkbox" <?php checked( (bool) $instance['show_catlink'], true ); ?>
140
+ name="<?php echo $this->get_field_name( 'show_catlink' ); ?>" />Link to category
141
+ </p>
142
+ <p>
143
+ <input type="checkbox" <?php checked( (bool) $instance['show_excerpt'], true ); ?>
144
+ name="<?php echo $this->get_field_name( 'show_excerpt' ); ?>" />Excerpt
145
+ </p>
146
+
list_cat_posts.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: List category posts
4
  Plugin URI: http://picandocodigo.net/programacion/wordpress/list-category-posts-wordpress-plugin-english/
5
  Description: List Category Posts allows you to list posts from a category into a post/page using the [catlist] shortcode. This shortcode accepts a category name or id, the order in which you want the posts to display, and the number of posts to display. You can use [catlist] as many times as needed with different arguments. Usage: [catlist argument1=value1 argument2=value2].
6
- Version: 0.19
7
  Author: Fernando Briano
8
  Author URI: http://picandocodigo.net/
9
  */
3
  Plugin Name: List category posts
4
  Plugin URI: http://picandocodigo.net/programacion/wordpress/list-category-posts-wordpress-plugin-english/
5
  Description: List Category Posts allows you to list posts from a category into a post/page using the [catlist] shortcode. This shortcode accepts a category name or id, the order in which you want the posts to display, and the number of posts to display. You can use [catlist] as many times as needed with different arguments. Usage: [catlist argument1=value1 argument2=value2].
6
+ Version: 0.19.1
7
  Author: Fernando Briano
8
  Author URI: http://picandocodigo.net/
9
  */
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: fernandobt
3
  Donate Link: http://picandocodigo.net/programacion/wordpress/list-category-posts-wordpress-plugin-english/#support
4
  Tags: list, categories, posts, cms
5
  Requires at least: 2.8
6
- Tested up to: 3.2..1
7
- Stable tag: 0.19
8
 
9
  == Description ==
10
  List Category Posts allows you to list posts from a category into a post/page using the [catlist] shortcode.
@@ -147,6 +147,10 @@ Template system has changed. Custom templates should be stored in WordPress them
147
 
148
  == Changelog ==
149
 
 
 
 
 
150
  = 0.19 =
151
  This update is dedicated to S. Keller from Switzerland who gave me "The Ultimate Hitchhiker's Guide to the Galaxy" from my Amazon Wishlit in appreciation for the plugin. I am really enjoying the read :D. If you
152
  * Fixed private post logic, not displaying post if private. Thanks Bainternet from WordPress Answers: http://wordpress.stackexchange.com/questions/12514/list-category-posts-not-showing-posts-marked-private-to-logged-in-users/12520#12520
3
  Donate Link: http://picandocodigo.net/programacion/wordpress/list-category-posts-wordpress-plugin-english/#support
4
  Tags: list, categories, posts, cms
5
  Requires at least: 2.8
6
+ Tested up to: 3.2.1
7
+ Stable tag: 0.19.1
8
 
9
  == Description ==
10
  List Category Posts allows you to list posts from a category into a post/page using the [catlist] shortcode.
147
 
148
  == Changelog ==
149
 
150
+ = 0.19.1 =
151
+ * Added thumbnail to Widget.
152
+ * Added thumbnail link to post (http://picod.net/33).
153
+
154
  = 0.19 =
155
  This update is dedicated to S. Keller from Switzerland who gave me "The Ultimate Hitchhiker's Guide to the Galaxy" from my Amazon Wishlit in appreciation for the plugin. I am really enjoying the read :D. If you
156
  * Fixed private post logic, not displaying post if private. Thanks Bainternet from WordPress Answers: http://wordpress.stackexchange.com/questions/12514/list-category-posts-not-showing-posts-marked-private-to-logged-in-users/12520#12520