List category posts - Version 0.47

Version Description

  • Adds Ukranian translation by Michael Yunat http://getvoip.com
    • Adds display_id parameter. Set it to yes to show the Post's ID next to the post title.
    • Adds starting_with parameter. Gets posts whose title start with a given letter.
Download this release

Release Info

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

Code changes from version 0.46.4 to 0.47

include/CatList.php CHANGED
@@ -4,7 +4,6 @@
4
  * Each time you use the shortcode, you get an instance of this class.
5
  * @author fernando@picandocodigo.net
6
  */
7
-
8
  class CatList{
9
  private $params = array();
10
  private $lcp_category_id = 0;
@@ -19,6 +18,11 @@ class CatList{
19
  * @param array $atts
20
  */
21
  public function __construct($atts) {
 
 
 
 
 
22
  $this->params = $atts;
23
 
24
  if ($this->lcp_not_empty('instance')){
@@ -158,6 +162,11 @@ class CatList{
158
  endif;
159
  endif;
160
 
 
 
 
 
 
161
  // for WP_Query compatibility
162
  // http://core.trac.wordpress.org/browser/tags/3.7.1/src/wp-includes/post.php#L1686
163
  $args['posts_per_page'] = $args['numberposts'];
@@ -166,6 +175,13 @@ class CatList{
166
  $query = new WP_Query;
167
  $this->lcp_categories_posts = $query->query($args);
168
  $this->posts_count = $query->found_posts;
 
 
 
 
 
 
 
169
  }
170
 
171
  /* Should I return posts or show that the tag/category or whatever
@@ -176,14 +192,12 @@ class CatList{
176
  private function lcp_should_return_posts() */
177
 
178
  private function lcp_not_empty($param){
179
- if ( ( isset($this->params[$param]) ) &&
180
- ( !empty($this->params[$param]) ) &&
181
- ( $this->params[$param] != '0' ) &&
182
- ( $this->params[$param] != '') ) :
183
- return true;
184
- else:
185
- return false;
186
- endif;
187
  }
188
 
189
 
@@ -460,8 +474,8 @@ class CatList{
460
  return $lcp_excerpt;
461
  }
462
  }
463
-
464
- private function lcp_trim_excerpt($text = ''){
465
  $excerpt_length = intval($this->params['excerpt_size']);
466
 
467
  $text = strip_shortcodes($text);
4
  * Each time you use the shortcode, you get an instance of this class.
5
  * @author fernando@picandocodigo.net
6
  */
 
7
  class CatList{
8
  private $params = array();
9
  private $lcp_category_id = 0;
18
  * @param array $atts
19
  */
20
  public function __construct($atts) {
21
+ load_plugin_textdomain(
22
+ 'list-category-posts',
23
+ false,
24
+ dirname( plugin_basename( __FILE__ ) ) . '/languages/'
25
+ );
26
  $this->params = $atts;
27
 
28
  if ($this->lcp_not_empty('instance')){
162
  endif;
163
  endif;
164
 
165
+ // Posts that start with a given letter:
166
+ if ( $this->lcp_not_empty('starting_with') ){
167
+ add_filter('posts_where' , array( $this, 'starting_with') );
168
+ }
169
+
170
  // for WP_Query compatibility
171
  // http://core.trac.wordpress.org/browser/tags/3.7.1/src/wp-includes/post.php#L1686
172
  $args['posts_per_page'] = $args['numberposts'];
175
  $query = new WP_Query;
176
  $this->lcp_categories_posts = $query->query($args);
177
  $this->posts_count = $query->found_posts;
178
+ remove_all_filters('posts_where');
179
+ }
180
+
181
+ public function starting_with($where){
182
+ $letter = $this->params['starting_with'];
183
+ $where .= ' AND wp_posts.post_title LIKE \'' . $letter . "%'";
184
+ return $where;
185
  }
186
 
187
  /* Should I return posts or show that the tag/category or whatever
192
  private function lcp_should_return_posts() */
193
 
194
  private function lcp_not_empty($param){
195
+ return (
196
+ isset($this->params[$param]) &&
197
+ !empty($this->params[$param]) &&
198
+ $this->params[$param] !== '0' &&
199
+ $this->params[$param] !== ''
200
+ );
 
 
201
  }
202
 
203
 
474
  return $lcp_excerpt;
475
  }
476
  }
477
+
478
+ private function lcp_trim_excerpt($text = ''){
479
  $excerpt_length = intval($this->params['excerpt_size']);
480
 
481
  $text = strip_shortcodes($text);
include/CatListDisplayer.php CHANGED
@@ -223,27 +223,31 @@ class CatListDisplayer {
223
  $lcp_display_output .= $this->get_author($single);
224
  endif;
225
 
 
 
 
 
226
 
227
  // Custom field display
228
  if (!empty($this->params['customfield_display'])) :
229
  if (!empty($this->params['customfield_tag'])):
230
  if (!empty($this->params['customfield_class'])):
231
  $lcp_display_output .= $this->get_custom_fields(
232
- $this->params['customfield_display'],
233
- $single->ID,
234
- $this->params['customfield_tag'],
235
- $this->params['customfield_class']);
236
  else:
237
  $lcp_display_output .= $this->get_custom_fields(
238
- $this->params['customfield_display'],
239
- $single->ID,
240
- $this->params['customfield_tag']);
241
  endif;
242
  else:
243
  $lcp_display_output .= $this->get_custom_fields(
244
- $this->params['customfield_display'],
245
- $single->ID
246
- );
247
  endif;
248
  endif;
249
 
223
  $lcp_display_output .= $this->get_author($single);
224
  endif;
225
 
226
+ // Display ID
227
+ if (!empty($this->params['display_id']) && $this->params['display_id'] == 'yes'){
228
+ $lcp_display_output .= $single->ID;
229
+ }
230
 
231
  // Custom field display
232
  if (!empty($this->params['customfield_display'])) :
233
  if (!empty($this->params['customfield_tag'])):
234
  if (!empty($this->params['customfield_class'])):
235
  $lcp_display_output .= $this->get_custom_fields(
236
+ $this->params['customfield_display'],
237
+ $single->ID,
238
+ $this->params['customfield_tag'],
239
+ $this->params['customfield_class']);
240
  else:
241
  $lcp_display_output .= $this->get_custom_fields(
242
+ $this->params['customfield_display'],
243
+ $single->ID,
244
+ $this->params['customfield_tag']);
245
  endif;
246
  else:
247
  $lcp_display_output .= $this->get_custom_fields(
248
+ $this->params['customfield_display'],
249
+ $single->ID
250
+ );
251
  endif;
252
  endif;
253
 
languages/list-category-posts-uk_UA.mo ADDED
Binary file
languages/list-category-posts-uk_UA.po ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2012
2
+ # This file is distributed under the same license as the package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: \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: 2014-05-22 14:05+0200\n"
12
+ "Last-Translator: Michael Yunat <Michael.Yunat@gmail.com>\n"
13
+ "Language-Team: LANGUAGE <LL@li.org>\n"
14
+ "Language: uk_UA\n"
15
+ "X-Generator: Poedit 1.6.5\n"
16
+
17
+ #: include/ListCategoryPostsWidget.php:5
18
+ msgid ""
19
+ "List Category Posts allows you to list posts from a category into a post/"
20
+ "page using the [catlist] shortcode. This shortcode accepts a category name "
21
+ "or id, the order in which you want the posts to display, and the number of "
22
+ "posts to display. You can use [catlist] as many times as needed with "
23
+ "different arguments. Usage: [catlist argument1=value1 argument2=value2]."
24
+ msgstr ""
25
+ "Список Категорія Повідомлень дозволяють перерахувати повідомлення від "
26
+ "категорії в запису / сторінки, використовуючи [Catlist] шорткод. Це шорткод "
27
+ "приймає ім&#39;я категорії або ідентифікатор, порядок, в якому ви хочете "
28
+ "пости для відображення, та кількість повідомлень для відображення. Ви можете "
29
+ "використовувати [Catlist] стільки разів, скільки необхідно з різними "
30
+ "аргументами. Використання: [Catlist аргумент1 = значение1 аргумент2 = "
31
+ "значення2]."
32
+
33
+ #: include/ListCategoryPostsWidget.php:11
34
+ msgid "List posts from a specified category"
35
+ msgstr "Список повідомлень від зазначеної категорії"
36
+
37
+ #: include/ListCategoryPostsWidget.php:12
38
+ msgid "List Category Posts"
39
+ msgstr "Список Категорія Повідомлень"
40
+
41
+ #: include/lcp_widget_form.php:40
42
+ msgid "Title"
43
+ msgstr "Назва"
44
+
45
+ #: include/lcp_widget_form.php:47
46
+ msgid "Category"
47
+ msgstr "Категорія"
48
+
49
+ #: include/lcp_widget_form.php:65
50
+ msgid "Number of posts"
51
+ msgstr "Кількість повідомлень"
52
+
53
+ #: include/lcp_widget_form.php:72
54
+ msgid "Offset"
55
+ msgstr "Зсув"
56
+
57
+ #: include/lcp_widget_form.php:78
58
+ msgid "Order by"
59
+ msgstr "Сортувати по"
60
+
61
+ #: include/lcp_widget_form.php:81 include/lcp_widget_form.php:123
62
+ msgid "Date"
63
+ msgstr "Дата"
64
+
65
+ #: include/lcp_widget_form.php:82
66
+ msgid "Post title"
67
+ msgstr "Найменування посади"
68
+
69
+ #: include/lcp_widget_form.php:83 include/lcp_widget_form.php:127
70
+ msgid "Author"
71
+ msgstr "Автор"
72
+
73
+ #: include/lcp_widget_form.php:84
74
+ msgid "Random"
75
+ msgstr "Випадковий"
76
+
77
+ #: include/lcp_widget_form.php:88
78
+ msgid "Order"
79
+ msgstr "Порядок"
80
+
81
+ #: include/lcp_widget_form.php:91
82
+ msgid "Descending"
83
+ msgstr "Спадний"
84
+
85
+ #: include/lcp_widget_form.php:92
86
+ msgid "Ascending"
87
+ msgstr "Висхідний"
88
+
89
+ #: include/lcp_widget_form.php:96
90
+ msgid "Exclude categories (id's)"
91
+ msgstr "Виключіть категорії (ідентифікатори)"
92
+
93
+ #: include/lcp_widget_form.php:102
94
+ msgid "Exclude posts (id's)"
95
+ msgstr "Виключити повідомлення (ідентифікатори)"
96
+
97
+ #: include/lcp_widget_form.php:109
98
+ msgid "Show"
99
+ msgstr "Показати"
100
+
101
+ #: include/lcp_widget_form.php:112
102
+ msgid "Thumbnail - size"
103
+ msgstr "Зображення - розмір"
104
+
105
+ #: include/lcp_widget_form.php:131
106
+ msgid "Link to category"
107
+ msgstr "Посилання на категорії"
108
+
109
+ #: include/lcp_widget_form.php:135
110
+ msgid "Excerpt"
111
+ msgstr "Витримка"
112
+
113
+ #: include/lcp_widget_form.php:138
114
+ msgid "More link"
115
+ msgstr "Більш посилання"
116
+
117
+ #: list_cat_posts.php:102
118
+ msgid "How to use"
119
+ msgstr "Як використовувати"
120
+
121
+ #: list_cat_posts.php:103
122
+ msgid "Donate"
123
+ msgstr "Жертвувати"
124
+
125
+ #: list_cat_posts.php:104
126
+ msgid "Fork on Github"
127
+ msgstr "Вилка на Github"
list_cat_posts.php CHANGED
@@ -1,32 +1,31 @@
1
  <?php
2
- /*
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.46.4
7
- Author: Fernando Briano
8
- Author URI: http://picandocodigo.net/
9
-
10
- Text Domain: list-category-posts
11
- Domain Path: /languages/
12
- */
13
-
14
- /* Copyright 2008-2014 Fernando Briano (email : fernando@picandocodigo.net)
15
-
16
- This program is free software; you can redistribute it and/or modify
17
- it under the terms of the GNU General Public License as published by
18
- the Free Software Foundation; either version 3 of the License, or
19
- any later version.
20
-
21
- This program is distributed in the hope that it will be useful,
22
- but WITHOUT ANY WARRANTY; without even the implied warranty of
23
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
- GNU General Public License for more details.
25
-
26
- You should have received a copy of the GNU General Public License
27
- along with this program; if not, write to the Free Software
28
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29
- */
30
 
31
  load_plugin_textdomain( 'list-category-posts', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
32
 
@@ -71,6 +70,7 @@ class ListCategoryPosts{
71
  'content' => 'no',
72
  'content_tag' => '',
73
  'content_class' => '',
 
74
  'catlink' => 'no',
75
  'catlink_string' => '',
76
  'catlink_tag' =>'',
@@ -78,6 +78,7 @@ class ListCategoryPosts{
78
  'comments' => 'no',
79
  'comments_tag' => '',
80
  'comments_class' => '',
 
81
  'thumbnail' => 'no',
82
  'thumbnail_size' => 'thumbnail',
83
  'thumbnail_class' => '',
1
  <?php
2
+ /*
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.47
7
+ Author: Fernando Briano
8
+ Author URI: http://picandocodigo.net/
9
+
10
+ Text Domain: list-category-posts
11
+ Domain Path: /languages/
12
+
13
+ Copyright 2008-2014 Fernando Briano (email : fernando@picandocodigo.net)
14
+
15
+ This program is free software; you can redistribute it and/or modify
16
+ it under the terms of the GNU General Public License as published by
17
+ the Free Software Foundation; either version 3 of the License, or
18
+ any later version.
19
+
20
+ This program is distributed in the hope that it will be useful,
21
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ GNU General Public License for more details.
24
+
25
+ You should have received a copy of the GNU General Public License
26
+ along with this program; if not, write to the Free Software
27
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28
+ */
 
29
 
30
  load_plugin_textdomain( 'list-category-posts', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
31
 
70
  'content' => 'no',
71
  'content_tag' => '',
72
  'content_class' => '',
73
+ 'display_id' => 'no',
74
  'catlink' => 'no',
75
  'catlink_string' => '',
76
  'catlink_tag' =>'',
78
  'comments' => 'no',
79
  'comments_tag' => '',
80
  'comments_class' => '',
81
+ 'starting_with' => '',
82
  'thumbnail' => 'no',
83
  'thumbnail_size' => 'thumbnail',
84
  'thumbnail_class' => '',
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.9
7
- Stable tag: 0.46.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -158,6 +158,8 @@ update the plugin.
158
  * **ASC** - Ascending (lowest to highest).
159
  * **DESC** - Descending (highest to lowest). Ex: `[catlist name=mycategory orderby=title order=asc]`
160
 
 
 
161
  * **numberposts** - Number of posts to return. Set to 0 to use the max
162
  number of posts per page. Set to -1 to remove the limit.
163
  Ex: `[catlist name=mycategory numberposts=10]`
@@ -242,6 +244,8 @@ update the plugin.
242
  WordPress
243
  </a> Hello World </li>```
244
 
 
 
245
  * **class** - CSS class for the default UL generated by the plugin.
246
 
247
  * **custom fields** - To use custom fields, you must specify two values: customfield_name and customfield_value. Using this only show posts that contain a custom field with this name and value. Both parameters must be defined, or neither will work.
@@ -292,6 +296,14 @@ Will print the value of the Custom Field "Mood" but not the text
292
 
293
  * **link_target** - Select the `target` attribute for links to posts (target=_blank, _self, _parent, _top, *framename*). Example: `[catlink id=3 link_target=_blank]` will create: `<a href="http://localhost/wordpress/?p=45" title="Test post" target="_blank">Test post</a>`
294
 
 
 
 
 
 
 
 
 
295
  == HTML & CSS Customization ==
296
 
297
  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.
@@ -386,6 +398,13 @@ Template system has changed. Custom templates should be stored in WordPress them
386
 
387
  == Changelog ==
388
 
 
 
 
 
 
 
 
389
  = 0.46.4 =
390
  * Finally (hopefully) fix the excerpt issues.
391
 
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.9.1
7
+ Stable tag: 0.47
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
158
  * **ASC** - Ascending (lowest to highest).
159
  * **DESC** - Descending (highest to lowest). Ex: `[catlist name=mycategory orderby=title order=asc]`
160
 
161
+ * **starting_with** - Get posts whose title starts with a certain letter. Example: `[catlist starting_with="l"]` will list all posts whose title starts with L.
162
+
163
  * **numberposts** - Number of posts to return. Set to 0 to use the max
164
  number of posts per page. Set to -1 to remove the limit.
165
  Ex: `[catlist name=mycategory numberposts=10]`
244
  WordPress
245
  </a> Hello World </li>```
246
 
247
+ * **display_id** - Set it to yes to show the Post's ID next to the post title: `[catlist id=3 display_id=yes]`
248
+
249
  * **class** - CSS class for the default UL generated by the plugin.
250
 
251
  * **custom fields** - To use custom fields, you must specify two values: customfield_name and customfield_value. Using this only show posts that contain a custom field with this name and value. Both parameters must be defined, or neither will work.
296
 
297
  * **link_target** - Select the `target` attribute for links to posts (target=_blank, _self, _parent, _top, *framename*). Example: `[catlink id=3 link_target=_blank]` will create: `<a href="http://localhost/wordpress/?p=45" title="Test post" target="_blank">Test post</a>`
298
 
299
+ == Widget ==
300
+
301
+ The widget is quite simple, and it doesn't implement all of the plugin's functionality. To use a shortcode in a widget add this code to your theme's functions.php file:
302
+
303
+ `add_filter('widget_text', 'do_shortcode');`
304
+
305
+ Then just add a new text widget to your blog and use the shortcode there as the widget's content.
306
+
307
  == HTML & CSS Customization ==
308
 
309
  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.
398
 
399
  == Changelog ==
400
 
401
+ = 0.47 =
402
+
403
+ * Adds Ukranian translation by Michael Yunat [http://getvoip.com](http://getvoip.com/blog)
404
+ * Adds `display_id` parameter. Set it to yes to show the Post's ID next to the post title.
405
+ * Adds `starting_with` parameter. Gets posts whose title start with a given letter.
406
+
407
+
408
  = 0.46.4 =
409
  * Finally (hopefully) fix the excerpt issues.
410