List category posts - Version 0.34

Version Description

  • Now the plugin accepts either class or tag or both for styling elements (such as date, author, etc. to display). When just using a tag, it will sorround the element with that tag. When using just a class, it will sorround the element between span tags and the given CSS class. Check Other notes under HTML & CSS Customization for more info.
    • Fixed bug on post_status, it used to show all published posts and if user was logged in, all private ones too. Now you can specify 'private' to just display private posts, and draft, publish, draft, etc (See post_status param on the instructions for more info).
Download this release

Release Info

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

Code changes from version 0.33 to 0.34

include/CatList.php CHANGED
@@ -56,7 +56,9 @@ class CatList{
56
  endif;
57
 
58
  if($this->lcp_not_empty('post_status')):
59
- $args['post_status'] = $this->params['post_status'];
 
 
60
  endif;
61
 
62
  if($this->lcp_not_empty('post_parent')):
@@ -87,7 +89,11 @@ class CatList{
87
 
88
  //Get private posts
89
  if(is_user_logged_in()):
90
- $args['post_status'] = array('publish','private');
 
 
 
 
91
  endif;
92
 
93
  if ( $this->lcp_not_empty('exclude_tags') ):
@@ -109,7 +115,7 @@ class CatList{
109
  elseif ( !empty($this->params['tags']) ):
110
  $args['tag'] = $this->params['tags'];
111
  endif;
112
-
113
  $this->lcp_categories_posts = get_posts($args);
114
  }
115
 
@@ -161,14 +167,18 @@ class CatList{
161
  $this->lcp_category_id = $this->get_category_id_by_name($this->params['name']);
162
  endif;
163
  elseif ( isset($this->params['id']) && $this->params['id'] != '0' ):
164
- if (preg_match('/\+/', $this->params['id'])):
165
- $this->lcp_category_id = explode("+", $this->params['id']);
 
 
 
166
  else:
167
- $this->lcp_category_id = $this->params['id'];
168
  endif;
169
  endif;
170
  }
171
 
 
172
  public function lcp_get_current_category(){
173
  $category = get_category( get_query_var( 'category' ) );
174
  if(isset($category->errors) && $category->errors["invalid_term"][0] == "Empty Term"):
56
  endif;
57
 
58
  if($this->lcp_not_empty('post_status')):
59
+ $args['post_status'] = array(
60
+ $this->params['post_status']
61
+ );
62
  endif;
63
 
64
  if($this->lcp_not_empty('post_parent')):
89
 
90
  //Get private posts
91
  if(is_user_logged_in()):
92
+ if ( !empty($args['post_status']) ):
93
+ $args['post_status'] = array_merge($args['post_status'], array('private'));
94
+ else:
95
+ $args['post_status'] = array('private', 'publish');
96
+ endif;
97
  endif;
98
 
99
  if ( $this->lcp_not_empty('exclude_tags') ):
115
  elseif ( !empty($this->params['tags']) ):
116
  $args['tag'] = $this->params['tags'];
117
  endif;
118
+ var_dump($args);
119
  $this->lcp_categories_posts = get_posts($args);
120
  }
121
 
167
  $this->lcp_category_id = $this->get_category_id_by_name($this->params['name']);
168
  endif;
169
  elseif ( isset($this->params['id']) && $this->params['id'] != '0' ):
170
+ $lcp_id = $this->params['id'];
171
+
172
+ if (preg_match('/\+/', $lcp_id)):
173
+ // Probably there's a "category and not" for cases of 2+3-1
174
+ $this->lcp_category_id = explode(",", str_replace("+", ",", str_replace("-", ",-", $lcp_id) ) );
175
  else:
176
+ $this->lcp_category_id = $lcp_id;
177
  endif;
178
  endif;
179
  }
180
 
181
+
182
  public function lcp_get_current_category(){
183
  $category = get_category( get_query_var( 'category' ) );
184
  if(isset($category->errors) && $category->errors["invalid_term"][0] == "Empty Term"):
include/CatListDisplayer.php CHANGED
@@ -143,14 +143,10 @@ class CatListDisplayer {
143
  endif;
144
 
145
  // Date
146
- if (!empty($this->params['date_tag'])):
147
- if (!empty($this->params['date_class'])):
148
- $lcp_display_output .= $this->get_date($single,
149
- $this->params['date_tag'],
150
- $this->params['date_class']);
151
- else:
152
- $lcp_display_output .= $this->get_date($single, $this->params['date_tag']);
153
- endif;
154
  else:
155
  $lcp_display_output .= $this->get_date($single);
156
  endif;
@@ -291,8 +287,10 @@ class CatListDisplayer {
291
  * @return string
292
  */
293
  private function assign_style($info, $tag = null, $css_class = null){
294
- if (!empty($info)):
295
- if (empty($tag)):
 
 
296
  return $info;
297
  elseif (!empty($tag) && empty($css_class)) :
298
  return '<' . $tag . '>' . $info . '</' . $tag . '>';
143
  endif;
144
 
145
  // Date
146
+ if (!empty($this->params['date_tag']) || !empty($this->params['date_class'])):
147
+ $lcp_display_output .= $this->get_date($single,
148
+ $this->params['date_tag'],
149
+ $this->params['date_class']);
 
 
 
 
150
  else:
151
  $lcp_display_output .= $this->get_date($single);
152
  endif;
287
  * @return string
288
  */
289
  private function assign_style($info, $tag = null, $css_class = null){
290
+ if (!empty($info)):
291
+ if (empty($tag) && !empty($css_class)):
292
+ $tag = "span";
293
+ elseif (empty($tag)):
294
  return $info;
295
  elseif (!empty($tag) && empty($css_class)) :
296
  return '<' . $tag . '>' . $info . '</' . $tag . '>';
languages/list-category-posts-tr_TR.mo DELETED
Binary file
languages/list-category-posts-tr_TR.po DELETED
@@ -1,128 +0,0 @@
1
- # Copyright (C) 2012
2
- # This file is distributed under the same license as the package.
3
- msgid ""
4
- msgstr ""
5
- "Project-Id-Version: list-category-posts\n"
6
- "Report-Msgid-Bugs-To: http://wordpress.org/tag/wp\n"
7
- "POT-Creation-Date: 2012-12-19 13:23:13+00:00\n"
8
- "MIME-Version: 1.0\n"
9
- "Content-Type: text/plain; charset=UTF-8\n"
10
- "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2013-01-27 20:15+0200\n"
12
- "Last-Translator: HakanEr <hakanerwptr@gmail.com>\n"
13
- "Language-Team: hakaner <hakanerwptr@gmail.com>\n"
14
- "Plural-Forms: nplurals=2; plural=n != 1;\n"
15
- "Language: turkish\n"
16
- "X-Generator: Poedit 1.5.4\n"
17
- "X-Poedit-SourceCharset: UTF-8\n"
18
-
19
- #: include/ListCategoryPostsWidget.php:5
20
- msgid ""
21
- "List Category Posts allows you to list posts from a category into a post/"
22
- "page using the [catlist] shortcode. This shortcode accepts a category name "
23
- "or id, the order in which you want the posts to display, and the number of "
24
- "posts to display. You can use [catlist] as many times as needed with "
25
- "different arguments. Usage: [catlist argument1=value1 argument2=value2]."
26
- msgstr ""
27
- "List Category Posts, [catlist] kısa kodunu kullanarak bir yazı/sayfa içinde "
28
- "bir kategorideki yazıları listeleyebilmenizi sağlar. Bu kısa kod, bir "
29
- "kategori adı veya id kimliği, yazıları görüntülemek istediğiniz sıra ve "
30
- "gösterilecek yazı sayısını kabul eder. Farklı değişkenler ile gerektiğinde "
31
- "birçok kez [catlist] kullanabilirsiniz. Kullanımı: [catlist değişken1=değer1 "
32
- "değişken2=değer2]."
33
-
34
- #: include/ListCategoryPostsWidget.php:11
35
- msgid "List posts from a specified category"
36
- msgstr "Belirli bir kategorideki yazıları listele"
37
-
38
- #: include/ListCategoryPostsWidget.php:12
39
- msgid "List Category Posts"
40
- msgstr "List Category Posts"
41
-
42
- #: include/lcp_widget_form.php:40
43
- msgid "Title"
44
- msgstr "Başlık"
45
-
46
- #: include/lcp_widget_form.php:47
47
- msgid "Category"
48
- msgstr "Kategori"
49
-
50
- #: include/lcp_widget_form.php:65
51
- msgid "Number of posts"
52
- msgstr "Yazı sayısı"
53
-
54
- #: include/lcp_widget_form.php:72
55
- msgid "Offset"
56
- msgstr "Kaydırma"
57
-
58
- #: include/lcp_widget_form.php:78
59
- msgid "Order by"
60
- msgstr "Sırala"
61
-
62
- #: include/lcp_widget_form.php:81 include/lcp_widget_form.php:123
63
- msgid "Date"
64
- msgstr "Tarih"
65
-
66
- #: include/lcp_widget_form.php:82
67
- msgid "Post title"
68
- msgstr "Yazı başlığı"
69
-
70
- #: include/lcp_widget_form.php:83 include/lcp_widget_form.php:127
71
- msgid "Author"
72
- msgstr "Yazar"
73
-
74
- #: include/lcp_widget_form.php:84
75
- msgid "Random"
76
- msgstr "Rasgele"
77
-
78
- #: include/lcp_widget_form.php:88
79
- msgid "Order"
80
- msgstr "Sıralama"
81
-
82
- #: include/lcp_widget_form.php:91
83
- msgid "Descending"
84
- msgstr "Azalan"
85
-
86
- #: include/lcp_widget_form.php:92
87
- msgid "Ascending"
88
- msgstr "Artan"
89
-
90
- #: include/lcp_widget_form.php:96
91
- msgid "Exclude categories (id's)"
92
- msgstr "Kategorileri (id'ler) hariç tut"
93
-
94
- #: include/lcp_widget_form.php:102
95
- msgid "Exclude posts (id's)"
96
- msgstr "Yazıları (id'ler) hariç tut"
97
-
98
- #: include/lcp_widget_form.php:109
99
- msgid "Show"
100
- msgstr "Göster"
101
-
102
- #: include/lcp_widget_form.php:112
103
- msgid "Thumbnail - size"
104
- msgstr "Küçük resim - boyut"
105
-
106
- #: include/lcp_widget_form.php:131
107
- msgid "Link to category"
108
- msgstr "Kategoriye bağlantı"
109
-
110
- #: include/lcp_widget_form.php:135
111
- msgid "Excerpt"
112
- msgstr "Alıntı"
113
-
114
- #: include/lcp_widget_form.php:138
115
- msgid "More link"
116
- msgstr "Devamı bağlantısı"
117
-
118
- #: list_cat_posts.php:102
119
- msgid "How to use"
120
- msgstr "Nasıl kullanılır"
121
-
122
- #: list_cat_posts.php:103
123
- msgid "Donate"
124
- msgstr "Bağış yap"
125
-
126
- #: list_cat_posts.php:104
127
- msgid "Fork on Github"
128
- msgstr "Github üzerinde incele"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
list_cat_posts.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: List category posts
4
  Plugin URI: https://github.com/picandocodigo/List-Category-Posts
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.33
7
  Author: Fernando Briano
8
  Author URI: http://picandocodigo.net/
9
 
3
  Plugin Name: List category posts
4
  Plugin URI: https://github.com/picandocodigo/List-Category-Posts
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.34
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: 3.3
6
- Tested up to: 3.6.1
7
- Stable tag: 0.33
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -169,7 +169,9 @@ When using List Category Posts whithout a category id, name or slug, it will pos
169
 
170
  == HTML & CSS Customization ==
171
 
172
- You can customize what HTML tags different elements will be sorrounded with and a CSS class for this element. The customizable elements are: author, catlink (category link), comments, date, excerpt, morelink ("Read More" link), thumbnail and title (post title).
 
 
173
 
174
  The parameters are:
175
  `autor_tag, author_class, catlink_tag, catlink_class, comments_tag, comments_class, date_tag, date_class,
@@ -185,6 +187,11 @@ Or you just want to style the displayed date, you could wrap it with a span tag:
185
  This would produce the following code:
186
  `<span class="lcp_date">March 21, 2011</span>`
187
 
 
 
 
 
 
188
 
189
  == Template System ==
190
 
@@ -205,10 +212,14 @@ You can have as many different templates as you want, and use them in different
205
 
206
  * **FAQ**
207
 
208
- Since version 0.18, **this plugins does not work on servers with PHP 4**. If you're still using PHP 4 on your webhost, you should consider upgrading to PHP 5. WordPress 3.1 was the last version to support PHP 4, from 3.2 and forward, only PHP 5 is supported. You can still [download an older version of the plugin](https://wordpress.org/extend/plugins/list-category-posts/download/ "download an older version of the plugin") if you're using PHP 4.
 
 
209
 
210
  **Plugin could not be activated because it triggered a fatal error.**
 
211
  *Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /.../wp-content/plugins/list-category-posts/include/CatListDisplayer.php on line 10*
 
212
  Please check:
213
  http://wordpress.stackexchange.com/questions/9338/list-category-posts-plugin-upgrade-fails-fatal-error/9340#9340
214
 
@@ -233,6 +244,10 @@ And in your theme's CSS:
233
 
234
  == Upgrade Notice ==
235
 
 
 
 
 
236
  = 0.25 =
237
  * Translation support.
238
 
@@ -256,6 +271,11 @@ Template system has changed. Custom templates should be stored in WordPress them
256
 
257
  == Changelog ==
258
 
 
 
 
 
 
259
  = 0.33 =
260
  * Fixes bug with thumbnail size on Widget.
261
  * Adds feature to make widget title a link to the category. Use 'catlink' as the value for the widget's title to make it a link to the category (based on https://github.com/picandocodigo/List-Category-Posts/pull/51/).
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: 3.3
6
+ Tested up to: 3.7.1
7
+ Stable tag: 0.34
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
169
 
170
  == HTML & CSS Customization ==
171
 
172
+ You can customize what HTML tags different elements will be sorrounded with and a CSS class for this element, or just a CSS class which will wrap the element with a `span` tag.
173
+
174
+ The customizable elements (so far) are: author, catlink (category link), comments, date, excerpt, morelink ("Read More" link), thumbnail and title (post title).
175
 
176
  The parameters are:
177
  `autor_tag, author_class, catlink_tag, catlink_class, comments_tag, comments_class, date_tag, date_class,
187
  This would produce the following code:
188
  `<span class="lcp_date">March 21, 2011</span>`
189
 
190
+ Elements without a specified tag, but a specified class, will be wrapped with a span tag and its class. For example this:
191
+ `[catlist id=7 date=yes date_class="lcp_date"]`
192
+ Will produce the following:
193
+ `<span class="lcp_date">October 23, 2013</span>`
194
+
195
 
196
  == Template System ==
197
 
212
 
213
  * **FAQ**
214
 
215
+ **Does not work on servers with PHP < 5**
216
+
217
+ This is true since version 0.18. If you're still using PHP 4 on your webhost, you should consider upgrading to PHP 5. WordPress 3.1 was the last version to support PHP 4, from 3.2 and forward, only PHP 5 is supported. You can still [download an older version of the plugin](https://wordpress.org/extend/plugins/list-category-posts/download/ "download an older version of the plugin") if you're using PHP 4.
218
 
219
  **Plugin could not be activated because it triggered a fatal error.**
220
+
221
  *Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /.../wp-content/plugins/list-category-posts/include/CatListDisplayer.php on line 10*
222
+
223
  Please check:
224
  http://wordpress.stackexchange.com/questions/9338/list-category-posts-plugin-upgrade-fails-fatal-error/9340#9340
225
 
244
 
245
  == Upgrade Notice ==
246
 
247
+ = 0.34 =
248
+ * Now the plugin accepts either class or tag or both for styling elements (such as date, author, etc. to display). When just using a tag, it will sorround the element with that tag. When using just a class, it will sorround the element between span tags and the given CSS class. Check [Other notes](http://wordpress.org/extend/plugins/list-category-posts/other_notes/) under **HTML & CSS Customization** for more info.
249
+ * Fixed bug on `post_status`, it used to show all published posts and if user was logged in, all private ones too. Now you can specify 'private' to just display private posts, and draft, publish, draft, etc (See **post_status** param on the [instructions](http://wordpress.org/extend/plugins/list-category-posts/other_notes/) for more info).
250
+
251
  = 0.25 =
252
  * Translation support.
253
 
271
 
272
  == Changelog ==
273
 
274
+ = 0.34 =
275
+
276
+ * Now accepts either class or tag or both for styling elements (such as date, author, etc. to display). When just using a tag, it will sorround the element with that tag. When using just a class, it will wrap the element between span tags and the given CSS class. Check [Other notes](http://wordpress.org/extend/plugins/list-category-posts/other_notes/) under **HTML & CSS Customization** for more info.
277
+ * Fixed bug on `post_status`, it used to show all published posts and if user was logged in, all private ones too. Now you can specify 'private' to just display private posts, and draft, publish, draft, etc (See **post_status** param on the [instructions](http://wordpress.org/extend/plugins/list-category-posts/other_notes/) for more info).
278
+
279
  = 0.33 =
280
  * Fixes bug with thumbnail size on Widget.
281
  * Adds feature to make widget title a link to the category. Use 'catlink' as the value for the widget's title to make it a link to the category (based on https://github.com/picandocodigo/List-Category-Posts/pull/51/).
templates/default.php CHANGED
@@ -90,8 +90,4 @@ foreach ($this->catlist->get_categories_posts() as $single):
90
  endforeach;
91
 
92
  $lcp_display_output .= '</ul>';
93
-
94
- // If there's a "more link", show it:
95
- $lcp_display_output .= $this->catlist->get_morelink();
96
-
97
  $this->lcp_output = $lcp_display_output;
90
  endforeach;
91
 
92
  $lcp_display_output .= '</ul>';
 
 
 
 
93
  $this->lcp_output = $lcp_display_output;