List category posts - Version 0.31

Version Description

  • Pull request from @cfoellmann, adds testing environment and Travis CI integration. Awesomeness.
    • When searching for a thumbnail, if there's no thumbnail on the post but there's a YouTube video, display the YouTube video thumbnail. (wordpress.org/support/topic/youtube-thumbnail)
Download this release

Release Info

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

Code changes from version 0.30.3 to 0.31

Files changed (3) hide show
  1. include/CatList.php +20 -10
  2. list_cat_posts.php +1 -1
  3. readme.txt +16 -3
include/CatList.php CHANGED
@@ -344,15 +344,13 @@ class CatList{
344
  *
345
  */
346
  public function get_thumbnail($single, $lcp_thumb_class = null){
 
 
347
  if ($this->params['thumbnail']=='yes'):
348
  $lcp_thumbnail = '';
349
  if ( has_post_thumbnail($single->ID) ):
350
-
351
- if ( in_array( $this->params['thumbnail_size'],
352
- array('thumbnail', 'medium', 'large', 'full')
353
- )):
354
  $lcp_thumb_size = $this->params['thumbnail_size'];
355
-
356
  elseif ($this->params['thumbnail_size']):
357
  $lcp_thumb_size = explode(",", $this->params['thumbnail_size']);
358
  else:
@@ -367,11 +365,23 @@ class CatList{
367
  ($lcp_thumb_class != null) ? array('class' => $lcp_thumb_class ) : null
368
  );
369
  $lcp_thumbnail .= '</a>';
 
 
 
 
 
 
 
 
 
 
 
370
  endif;
371
- return $lcp_thumbnail;
372
 
373
- else:
374
- return null;
 
375
  endif;
376
- }
377
- }
 
344
  *
345
  */
346
  public function get_thumbnail($single, $lcp_thumb_class = null){
347
+ $lcp_thumbnail = null;
348
+
349
  if ($this->params['thumbnail']=='yes'):
350
  $lcp_thumbnail = '';
351
  if ( has_post_thumbnail($single->ID) ):
352
+ if ( in_array( $this->params['thumbnail_size'],array('thumbnail', 'medium', 'large', 'full') )):
 
 
 
353
  $lcp_thumb_size = $this->params['thumbnail_size'];
 
354
  elseif ($this->params['thumbnail_size']):
355
  $lcp_thumb_size = explode(",", $this->params['thumbnail_size']);
356
  else:
365
  ($lcp_thumb_class != null) ? array('class' => $lcp_thumb_class ) : null
366
  );
367
  $lcp_thumbnail .= '</a>';
368
+
369
+ # Check for a YouTube video thumbnail
370
+ elseif (
371
+ preg_match("/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^<\s]*)/", $single->post_content, $matches)
372
+ ||
373
+ preg_match("/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/(v\/)([a-zA-Z0-9\-\_]{11})([^<\s]*)/", $single->post_content, $matches)
374
+ ):
375
+ $youtubeurl = $matches[0];
376
+
377
+ if ($youtubeurl):
378
+ $imageurl = "http://i.ytimg.com/vi/{$matches[3]}/1.jpg";
379
  endif;
 
380
 
381
+ $lcp_thumbnail = '<a href="' . get_permalink($single->ID).'">';
382
+ $lcp_thumbnail .= '<img src="' . $imageurl . '" alt="' . $single->title . '" />';
383
+ $lcp_thumbnail .= '</a>';
384
  endif;
385
+ endif;
386
+ return $lcp_thumbnail;
387
+ }}
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.30.3
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.31
7
  Author: Fernando Briano
8
  Author URI: http://picandocodigo.net/
9
 
readme.txt CHANGED
@@ -3,8 +3,10 @@ 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.5
7
- Stable tag: 0.30.3
 
 
8
 
9
  == Description ==
10
  List Category Posts allows you to list posts from a category into a post/page using the [catlist] shortcode. When you're editing a page or post, directly insert the shortcode in your text and the posts will be listed there. The **basic** usage would be something like this:
@@ -26,6 +28,14 @@ Great to use WordPress as a CMS, and create pages with several categories posts.
26
 
27
  Please, read the information on [Other Notes](http://wordpress.org/extend/plugins/list-category-posts/other_notes/) and [Changelog](http://wordpress.org/extend/plugins/list-category-posts/changelog/) to be aware of new functionality, and improvements to the plugin.
28
 
 
 
 
 
 
 
 
 
29
  **Support the plugin**
30
 
31
  If you've found the plugin useful, consider making a [donation via PayPal](http://picandocodigo.net/programacion/wordpress/list-category-posts-wordpress-plugin-english/ "Donate via PayPal") or visit my Amazon Wishlist for [books](http://www.amazon.com/gp/registry/wishlist/2HU1JYOF7DX5Q/ref=wl_web "Amazon Wishlist") or [comic books](http://www.amazon.com/registry/wishlist/1LVYAOJAZQOI0/ref=cm_wl_rlist_go_o) :).
@@ -46,7 +56,6 @@ I've moved the development to [GitHub](https://github.com/picandocodigo/List-Cat
46
 
47
  ==INSTRUCTIONS on how to use the plugin==
48
 
49
-
50
  ==Selecting the category==
51
  The plugin can figure out the category from which you want to list posts in several ways. **You should use only one of these methods** since these are all mutually exclusive, weird results are expected when using more than one:
52
 
@@ -245,6 +254,10 @@ Template system has changed. Custom templates should be stored in WordPress them
245
 
246
  == Changelog ==
247
 
 
 
 
 
248
  = 0.30.3 =
249
  * Bugfix release, fixes current category for post/page
250
 
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.31
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
  == Description ==
12
  List Category Posts allows you to list posts from a category into a post/page using the [catlist] shortcode. When you're editing a page or post, directly insert the shortcode in your text and the posts will be listed there. The **basic** usage would be something like this:
28
 
29
  Please, read the information on [Other Notes](http://wordpress.org/extend/plugins/list-category-posts/other_notes/) and [Changelog](http://wordpress.org/extend/plugins/list-category-posts/changelog/) to be aware of new functionality, and improvements to the plugin.
30
 
31
+ ** Videos **
32
+
33
+ Some users have made videos on how to use the plugin, (thank you! you people are awesome!). Check them out here:
34
+
35
+ * [Manage WordPress Content with List Category Posts Plugin](http://www.youtube.com/watch?v=kBy_qoGKpdo)
36
+ * [Build A Start Here Page with List Category Posts](http://www.youtube.com/watch?v=9YJpZfHIwIY)
37
+ * [WordPress: How to List Category Posts on a Page](http://www.youtube.com/watch?v=Zfnzk4IWPNA)
38
+
39
  **Support the plugin**
40
 
41
  If you've found the plugin useful, consider making a [donation via PayPal](http://picandocodigo.net/programacion/wordpress/list-category-posts-wordpress-plugin-english/ "Donate via PayPal") or visit my Amazon Wishlist for [books](http://www.amazon.com/gp/registry/wishlist/2HU1JYOF7DX5Q/ref=wl_web "Amazon Wishlist") or [comic books](http://www.amazon.com/registry/wishlist/1LVYAOJAZQOI0/ref=cm_wl_rlist_go_o) :).
56
 
57
  ==INSTRUCTIONS on how to use the plugin==
58
 
 
59
  ==Selecting the category==
60
  The plugin can figure out the category from which you want to list posts in several ways. **You should use only one of these methods** since these are all mutually exclusive, weird results are expected when using more than one:
61
 
254
 
255
  == Changelog ==
256
 
257
+ = 0.31 =
258
+ * Pull request from @cfoellmann, adds testing environment and Travis CI integration. Awesomeness.
259
+ * When searching for a thumbnail, if there's no thumbnail on the post but there's a YouTube video, display the YouTube video thumbnail. (wordpress.org/support/topic/youtube-thumbnail)
260
+
261
  = 0.30.3 =
262
  * Bugfix release, fixes current category for post/page
263