List category posts - Version 0.21

Version Description

  • Added 'thumbnail_class' parameter, so you can set a CSS class to the thumbnail and style it.
Download this release

Release Info

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

Code changes from version 0.20.5 to 0.21

include/CatList.php CHANGED
@@ -219,11 +219,17 @@ class CatList{
219
  * @param unknown_type $single
220
  *
221
  */
222
- public function get_thumbnail($single){
223
  if ($this->params['thumbnail']=='yes'){
224
  $lcp_thumbnail = '';
225
  if ( has_post_thumbnail($single->ID) ) {
226
- $lcp_thumbnail = '<a href="' . get_permalink($single->ID).'">' . get_the_post_thumbnail($single->ID, $this->params['thumbnail_size']) . '</a>';
 
 
 
 
 
 
227
  }
228
  return $lcp_thumbnail;
229
  } else {
219
  * @param unknown_type $single
220
  *
221
  */
222
+ public function get_thumbnail($single, $lcp_thumb_class = null){
223
  if ($this->params['thumbnail']=='yes'){
224
  $lcp_thumbnail = '';
225
  if ( has_post_thumbnail($single->ID) ) {
226
+ if ( $lcp_thumb_class != null){
227
+ $lcp_thumbnail = '<a href="' . get_permalink($single->ID).'">' .
228
+ get_the_post_thumbnail($single->ID, $this->params['thumbnail_size'], array('class' => $lcp_thumb_class )) . '</a>';
229
+ }else {
230
+ $lcp_thumbnail = '<a href="' . get_permalink($single->ID).'">' .
231
+ get_the_post_thumbnail($single->ID, $this->params['thumbnail_size']) . '</a>';
232
+ }
233
  }
234
  return $lcp_thumbnail;
235
  } else {
include/CatListDisplayer.php CHANGED
@@ -131,9 +131,14 @@ class CatListDisplayer {
131
  return $this->assign_style($info, $tag, $css_class);
132
  }
133
 
134
- private function get_thumbnail($single, $tag = null, $css_class = null){
135
- $info = $this->catlist->get_thumbnail($single);
136
- return $this->assign_style($info, $tag, $css_class);
 
 
 
 
 
137
  }
138
 
139
  private function get_post_title($single, $tag = null, $css_class = null){
@@ -164,7 +169,4 @@ class CatListDisplayer {
164
  return '<' . $tag . ' class="' . $css_class . '">' . $info . '</' . $tag . '>';
165
  }
166
  }
167
-
168
-
169
-
170
  }
131
  return $this->assign_style($info, $tag, $css_class);
132
  }
133
 
134
+ private function get_thumbnail($single, $tag = null){
135
+ if ( isset($this->params['thumbnail_class']) && $this->params['thumbnail_class'] != '' ){
136
+ $lcp_thumb_class = $this->params['thumbnail_class'];
137
+ $info = $this->catlist->get_thumbnail($single, $lcp_thumb_class);
138
+ } else {
139
+ $info = $this->catlist->get_thumbnail($single);
140
+ }
141
+ return $this->assign_style($info, $tag);
142
  }
143
 
144
  private function get_post_title($single, $tag = null, $css_class = null){
169
  return '<' . $tag . ' class="' . $css_class . '">' . $info . '</' . $tag . '>';
170
  }
171
  }
 
 
 
172
  }
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.20.5
7
  Author: Fernando Briano
8
  Author URI: http://picandocodigo.net/
9
  */
@@ -55,6 +55,7 @@ class ListCategoryPosts{
55
  'comments' => 'no',
56
  'thumbnail' => 'no',
57
  'thumbnail_size' => 'thumbnail',
 
58
  'post_type' => '',
59
  'post_parent' => '0',
60
  'class' => 'lcp_catlist',
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.21
7
  Author: Fernando Briano
8
  Author URI: http://picandocodigo.net/
9
  */
55
  'comments' => 'no',
56
  'thumbnail' => 'no',
57
  'thumbnail_size' => 'thumbnail',
58
+ 'thumbnail_class' => '',
59
  'post_type' => '',
60
  'post_parent' => '0',
61
  'class' => 'lcp_catlist',
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate Link: http://picandocodigo.net/programacion/wordpress/list-category-posts
4
  Tags: list, categories, posts, cms
5
  Requires at least: 2.8
6
  Tested up to: 3.2.1
7
- Stable tag: 0.20.5
8
 
9
  == Description ==
10
  List Category Posts allows you to list posts from a category into a post/page using the [catlist] shortcode.
@@ -99,6 +99,8 @@ You can use the *categorypage* parameter to make it detect the category id of th
99
 
100
  * **thumbnail_size** - Either a string keyword (thumbnail, medium, large or full) or a 2-item array representing width and height in pixels, e.g. array(32,32).
101
 
 
 
102
  * **post_type** - The type of post to show. Available options are: post - Default, page, attachment, any - all post types.
103
 
104
  * **post_parent** - Show only the children of the post with this ID. Default: None.
@@ -156,6 +158,9 @@ Template system has changed. Custom templates should be stored in WordPress them
156
 
157
  == Changelog ==
158
 
 
 
 
159
  = 0.20.5 =
160
  * Brought back the multiple categories functionality for the id parameter. Hopefully the last 0.20 bugfix release so I can start working on new stuff to implement.
161
  * Now the name parameter accepts multiple categories too. Just use: `[catlist name=category1,category2]`
4
  Tags: list, categories, posts, cms
5
  Requires at least: 2.8
6
  Tested up to: 3.2.1
7
+ Stable tag: 0.21
8
 
9
  == Description ==
10
  List Category Posts allows you to list posts from a category into a post/page using the [catlist] shortcode.
99
 
100
  * **thumbnail_size** - Either a string keyword (thumbnail, medium, large or full) or a 2-item array representing width and height in pixels, e.g. array(32,32).
101
 
102
+ * **thumbnail_class** - Set a CSS class to the thumbnail and style it.
103
+
104
  * **post_type** - The type of post to show. Available options are: post - Default, page, attachment, any - all post types.
105
 
106
  * **post_parent** - Show only the children of the post with this ID. Default: None.
158
 
159
  == Changelog ==
160
 
161
+ = 0.21 =
162
+ * Added 'thumbnail_class' parameter, so you can set a CSS class to the thumbnail and style it.
163
+
164
  = 0.20.5 =
165
  * Brought back the multiple categories functionality for the id parameter. Hopefully the last 0.20 bugfix release so I can start working on new stuff to implement.
166
  * Now the name parameter accepts multiple categories too. Just use: `[catlist name=category1,category2]`