List category posts - Version 0.37

Version Description

When using content=yes, if the post has a more tag, the plugin will only show the content previous to the more tag and not all the content as it used before (it now supports the more tag the same way as WordPress).

Download this release

Release Info

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

Code changes from version 0.36.2 to 0.37

Files changed (3) hide show
  1. include/CatList.php +27 -12
  2. list_cat_posts.php +4 -7
  3. readme.txt +12 -2
include/CatList.php CHANGED
@@ -244,7 +244,7 @@ class CatList{
244
  return null;
245
  endif;
246
  }
247
-
248
  /**
249
  * Load morelink name and link to the category:
250
  */
@@ -338,13 +338,17 @@ class CatList{
338
  $single->post_content):
339
 
340
  $lcp_content = $single->post_content;
341
- /* Need to put some more thought on this!
342
- * Added to stop a post with catlist to display an infinite loop of
343
- * catlist shortcode parsing
344
- * added to parse shortcodes
345
- */
346
  $lcp_content = apply_filters('the_content', $lcp_content);
347
  $lcp_content = str_replace(']]>', ']]&gt', $lcp_content);
 
 
 
 
 
 
 
 
 
348
  return $lcp_content;
349
  else:
350
  return null;
@@ -399,7 +403,12 @@ class CatList{
399
  if ($this->params['thumbnail']=='yes'):
400
  $lcp_thumbnail = '';
401
  if ( has_post_thumbnail($single->ID) ):
402
- if ( in_array( $this->params['thumbnail_size'],array('thumbnail', 'medium', 'large', 'full') )):
 
 
 
 
 
403
  $lcp_thumb_size = $this->params['thumbnail_size'];
404
  elseif ($this->params['thumbnail_size']):
405
  $lcp_thumb_size = explode(",", $this->params['thumbnail_size']);
@@ -421,6 +430,8 @@ class CatList{
421
  preg_match("/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^<\s]*)/", $single->post_content, $matches)
422
  ||
423
  preg_match("/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/(v\/)([a-zA-Z0-9\-\_]{11})([^<\s]*)/", $single->post_content, $matches)
 
 
424
  ):
425
  $youtubeurl = $matches[0];
426
 
@@ -428,11 +439,15 @@ class CatList{
428
  $imageurl = "http://i.ytimg.com/vi/{$matches[3]}/1.jpg";
429
  endif;
430
 
431
- $lcp_thumbnail = '<a href="' . get_permalink($single->ID).'">' .
432
- '<img src="' . $imageurl .
433
- ( ($lcp_thumb_class != null) ? 'class="' . $lcp_thumb_class .'"' : null ) .
434
- '" alt="' . $single->title . '" />';
435
- $lcp_thumbnail .= '</a>';
 
 
 
 
436
  endif;
437
  endif;
438
  return $lcp_thumbnail;
244
  return null;
245
  endif;
246
  }
247
+
248
  /**
249
  * Load morelink name and link to the category:
250
  */
338
  $single->post_content):
339
 
340
  $lcp_content = $single->post_content;
 
 
 
 
 
341
  $lcp_content = apply_filters('the_content', $lcp_content);
342
  $lcp_content = str_replace(']]>', ']]&gt', $lcp_content);
343
+
344
+ if ( preg_match('/<!--more(.*?)?-->/', $lcp_content, $matches) ):
345
+ $lcp_more = __('Continue reading &rarr;', 'list-category-posts');
346
+ $lcp_post_content = explode($matches[0], $lcp_content, 2);
347
+ $lcp_content = $lcp_post_content[0] .
348
+ ' <a href="' . get_permalink($single->ID) . ' title="' . "$lcp_more" . '">' .
349
+ $lcp_more . '</a>';
350
+ endif;
351
+
352
  return $lcp_content;
353
  else:
354
  return null;
403
  if ($this->params['thumbnail']=='yes'):
404
  $lcp_thumbnail = '';
405
  if ( has_post_thumbnail($single->ID) ):
406
+ $avalaible_image_sizes = get_intermediate_image_sizes();
407
+ if ( in_array(
408
+ $this->params['thumbnail_size'],
409
+ $avalaible_image_sizes
410
+ )
411
+ ):
412
  $lcp_thumb_size = $this->params['thumbnail_size'];
413
  elseif ($this->params['thumbnail_size']):
414
  $lcp_thumb_size = explode(",", $this->params['thumbnail_size']);
430
  preg_match("/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^<\s]*)/", $single->post_content, $matches)
431
  ||
432
  preg_match("/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/(v\/)([a-zA-Z0-9\-\_]{11})([^<\s]*)/", $single->post_content, $matches)
433
+ ||
434
+ preg_match("/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/(embed)\/([a-zA-Z0-9\-\_]{11})[^<\s]*/", $single->post_content, $matches)
435
  ):
436
  $youtubeurl = $matches[0];
437
 
439
  $imageurl = "http://i.ytimg.com/vi/{$matches[3]}/1.jpg";
440
  endif;
441
 
442
+ $lcp_ytimage = '<img src="' . $imageurl . '" alt="' . $single->post_title . '" />';
443
+
444
+ if ($lcp_thumb_class != null):
445
+ $thmbn_class = ' class="' . $lcp_thumb_class . '" />';
446
+ $lcp_ytimage = preg_replace("/\>/", $thmbn_class, $lcp_ytimage);
447
+ endif;
448
+
449
+ $lcp_thumbnail .= '<a href="' . get_permalink($single->ID).'">' . $lcp_ytimage . '</a>';
450
+
451
  endif;
452
  endif;
453
  return $lcp_thumbnail;
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.36.2
7
  Author: Fernando Briano
8
  Author URI: http://picandocodigo.net/
9
 
@@ -129,12 +129,9 @@ add_filter( 'plugin_row_meta', 'lpc_meta', 10, 2 );
129
 
130
  /**
131
  * TO-DO:
132
- Add Older Posts at bottom of List Category Post page
133
- http://wordpress.stackexchange.com/questions/26398/add-older-posts-at-bottom-of-list-category-post-page
134
- Getting the “more” tag to work with plugin-list-category-post
135
- http://wordpress.stackexchange.com/questions/30376/getting-the-more-tag-to-work-with-plugin-list-category-post
136
- - Fix the code for the WordPress Coding Standards: http://codex.wordpress.org/WordPress_Coding_Standards
137
- - Pagination
138
  - Simpler template system
139
  - Exclude child categories
140
  */
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.37
7
  Author: Fernando Briano
8
  Author URI: http://picandocodigo.net/
9
 
129
 
130
  /**
131
  * TO-DO:
132
+
133
+ - Pagination * DONE - Need to add "page" text
134
+ - Add Older Posts at bottom of List Category Post page
 
 
 
135
  - Simpler template system
136
  - Exclude child categories
137
  */
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: 3.3
6
  Tested up to: 3.7.1
7
- Stable tag: 0.36.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -126,7 +126,7 @@ When using List Category Posts whithout a category id, name or slug, it will pos
126
 
127
  * **offset** - You can displace or pass over one or more initial posts which would normally be collected by your query through the use of the offset parameter.
128
 
129
- * **content** - Show the full content of the post. Default is 'no'. Ex: `[catlist content=yes]`
130
 
131
  * **catlink** - Show the title of the category with a link to the category. Use the **catlink_string** option to change the link text. Default is 'no'. Ex: `[catlist catlink=yes]`. The way it's programmed, it should only display the title for the first category you chose, and include the posts from all of the categories. I thought of this parameter mostly for using several shortcodes on one page or post, so that each group of posts would have the title of that group's category. If you need to display several titles with posts, you should use one [catlist] shortcode for each category you want to display.
132
 
@@ -247,6 +247,10 @@ And in your theme's CSS:
247
 
248
  == Upgrade Notice ==
249
 
 
 
 
 
250
  = 0.34 =
251
  * 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.
252
  * 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).
@@ -274,6 +278,12 @@ Template system has changed. Custom templates should be stored in WordPress them
274
 
275
  == Changelog ==
276
 
 
 
 
 
 
 
277
  = 0.36.2 =
278
 
279
  * Fixed category_count for several categories.
4
  Tags: list, categories, posts, cms
5
  Requires at least: 3.3
6
  Tested up to: 3.7.1
7
+ Stable tag: 0.37
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
126
 
127
  * **offset** - You can displace or pass over one or more initial posts which would normally be collected by your query through the use of the offset parameter.
128
 
129
+ * **content** - Show the full content of the post. If there's a &lt;!--more--&gt; tag in the post, then it will behave just as WordPress does: only show the content previous to the more tag. Default is 'no'. Ex: `[catlist content=yes]`
130
 
131
  * **catlink** - Show the title of the category with a link to the category. Use the **catlink_string** option to change the link text. Default is 'no'. Ex: `[catlist catlink=yes]`. The way it's programmed, it should only display the title for the first category you chose, and include the posts from all of the categories. I thought of this parameter mostly for using several shortcodes on one page or post, so that each group of posts would have the title of that group's category. If you need to display several titles with posts, you should use one [catlist] shortcode for each category you want to display.
132
 
247
 
248
  == Upgrade Notice ==
249
 
250
+ = 0.37 =
251
+
252
+ When using `content=yes`, if the post has a more tag, the plugin will only show the content previous to the more tag and not all the content as it used before (it now supports the more tag the same way as WordPress).
253
+
254
  = 0.34 =
255
  * 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.
256
  * 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
  == Changelog ==
280
 
281
+ = 0.37 =
282
+
283
+ * Supports `more` tag. If there's a &lt;!--more--&gt; tag in the post, then it will behave just as WordPress does: only show the content previous to the more tag.
284
+ * Fixes YouTube thumbnails: Includes "embed" urls for youtube video
285
+ thumbnails, makes correct img tag when using CSS class.
286
+
287
  = 0.36.2 =
288
 
289
  * Fixed category_count for several categories.