Version Description
- Add category count parameter to show the number of posts in a category next to its title. Only works when using the catlink option:
[catlist name=nintendo catlink=yes category_count=yes]
- http://wordpress.org/support/topic/count-feature
Download this release
Release Info
Developer | fernandobt |
Plugin | List category posts |
Version | 0.32 |
Comparing to | |
See all releases |
Code changes from version 0.31 to 0.32
- include/CatList.php +14 -4
- include/CatListDisplayer.php +5 -1
- list_cat_posts.php +3 -2
- readme.txt +7 -2
include/CatList.php
CHANGED
@@ -16,6 +16,7 @@ class CatList{
|
|
16 |
*/
|
17 |
public function __construct($atts) {
|
18 |
$this->params = $atts;
|
|
|
19 |
//Get the category posts:
|
20 |
$this->get_lcp_category();
|
21 |
$this->set_lcp_parameters();
|
@@ -210,12 +211,18 @@ class CatList{
|
|
210 |
$cat_title = get_cat_name($this->lcp_category_id);
|
211 |
|
212 |
return '<a href="' . $cat_link . '" title="' . $cat_title . '">' .
|
213 |
-
($this->params['catlink_string'] !== '' ? $this->params['catlink_string'] : $cat_title) . '</a>';
|
214 |
else:
|
215 |
return null;
|
216 |
endif;
|
217 |
}
|
218 |
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
/**
|
220 |
* Display custom fields.
|
221 |
* @see http://codex.wordpress.org/Function_Reference/get_post_custom
|
@@ -378,10 +385,13 @@ class CatList{
|
|
378 |
$imageurl = "http://i.ytimg.com/vi/{$matches[3]}/1.jpg";
|
379 |
endif;
|
380 |
|
381 |
-
$lcp_thumbnail = '<a href="' . get_permalink($single->ID).'">'
|
382 |
-
|
|
|
|
|
383 |
$lcp_thumbnail .= '</a>';
|
384 |
endif;
|
385 |
endif;
|
386 |
return $lcp_thumbnail;
|
387 |
-
}
|
|
16 |
*/
|
17 |
public function __construct($atts) {
|
18 |
$this->params = $atts;
|
19 |
+
|
20 |
//Get the category posts:
|
21 |
$this->get_lcp_category();
|
22 |
$this->set_lcp_parameters();
|
211 |
$cat_title = get_cat_name($this->lcp_category_id);
|
212 |
|
213 |
return '<a href="' . $cat_link . '" title="' . $cat_title . '">' .
|
214 |
+
($this->params['catlink_string'] !== '' ? $this->params['catlink_string'] : $cat_title) . $this->get_category_count() . '</a>';
|
215 |
else:
|
216 |
return null;
|
217 |
endif;
|
218 |
}
|
219 |
|
220 |
+
public function get_category_count(){
|
221 |
+
if($this->params['category_count'] == 'yes'):
|
222 |
+
return ' (' . get_category($this->lcp_category_id)->category_count . ')';
|
223 |
+
endif;
|
224 |
+
}
|
225 |
+
|
226 |
/**
|
227 |
* Display custom fields.
|
228 |
* @see http://codex.wordpress.org/Function_Reference/get_post_custom
|
385 |
$imageurl = "http://i.ytimg.com/vi/{$matches[3]}/1.jpg";
|
386 |
endif;
|
387 |
|
388 |
+
$lcp_thumbnail = '<a href="' . get_permalink($single->ID).'">' .
|
389 |
+
'<img src="' . $imageurl .
|
390 |
+
( ($lcp_thumb_class != null) ? 'class="' . $lcp_thumb_class .'"' : null ) .
|
391 |
+
'" alt="' . $single->title . '" />';
|
392 |
$lcp_thumbnail .= '</a>';
|
393 |
endif;
|
394 |
endif;
|
395 |
return $lcp_thumbnail;
|
396 |
+
}
|
397 |
+
}
|
include/CatListDisplayer.php
CHANGED
@@ -113,7 +113,7 @@ class CatListDisplayer {
|
|
113 |
$lcp_display_output .= $this->get_post_title($single) . ' ';
|
114 |
endif;
|
115 |
|
116 |
-
//
|
117 |
if (!empty($this->params['comments_tag'])):
|
118 |
if (!empty($this->params['comments_class'])):
|
119 |
$lcp_display_output .= $this->get_comments($single,
|
@@ -256,6 +256,10 @@ class CatListDisplayer {
|
|
256 |
return $this->assign_style($info, $tag, $css_class);
|
257 |
}
|
258 |
|
|
|
|
|
|
|
|
|
259 |
/**
|
260 |
* Assign style to the info delivered by CatList. Tag is an HTML tag
|
261 |
* which is passed and will sorround the info. Css_class is the css
|
113 |
$lcp_display_output .= $this->get_post_title($single) . ' ';
|
114 |
endif;
|
115 |
|
116 |
+
// Comments count
|
117 |
if (!empty($this->params['comments_tag'])):
|
118 |
if (!empty($this->params['comments_class'])):
|
119 |
$lcp_display_output .= $this->get_comments($single,
|
256 |
return $this->assign_style($info, $tag, $css_class);
|
257 |
}
|
258 |
|
259 |
+
private function get_category_count(){
|
260 |
+
return $this->catlist->get_category_count();
|
261 |
+
}
|
262 |
+
|
263 |
/**
|
264 |
* Assign style to the info delivered by CatList. Tag is an HTML tag
|
265 |
* which is passed and will sorround the info. Css_class is the css
|
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.
|
7 |
Author: Fernando Briano
|
8 |
Author URI: http://picandocodigo.net/
|
9 |
|
@@ -39,7 +39,7 @@ class ListCategoryPosts{
|
|
39 |
* @param $atts
|
40 |
* @param $content
|
41 |
*/
|
42 |
-
function catlist_func($atts, $content = null) {
|
43 |
$atts = shortcode_atts(array(
|
44 |
'id' => '0',
|
45 |
'name' => '',
|
@@ -89,6 +89,7 @@ class ListCategoryPosts{
|
|
89 |
'customfield_display' =>'',
|
90 |
'taxonomy' => '',
|
91 |
'categorypage' => '',
|
|
|
92 |
'morelink' => '',
|
93 |
'morelink_class' => '',
|
94 |
'posts_morelink' => '',
|
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.32
|
7 |
Author: Fernando Briano
|
8 |
Author URI: http://picandocodigo.net/
|
9 |
|
39 |
* @param $atts
|
40 |
* @param $content
|
41 |
*/
|
42 |
+
static function catlist_func($atts, $content = null) {
|
43 |
$atts = shortcode_atts(array(
|
44 |
'id' => '0',
|
45 |
'name' => '',
|
89 |
'customfield_display' =>'',
|
90 |
'taxonomy' => '',
|
91 |
'categorypage' => '',
|
92 |
+
'category_count' => '',
|
93 |
'morelink' => '',
|
94 |
'morelink_class' => '',
|
95 |
'posts_morelink' => '',
|
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.6.1
|
7 |
-
Stable tag: 0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -28,7 +28,7 @@ Great to use WordPress as a CMS, and create pages with several categories posts.
|
|
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 |
-
**
|
32 |
|
33 |
Some users have made videos on how to use the plugin, (thank you! you people are awesome!). Check them out here:
|
34 |
|
@@ -129,6 +129,8 @@ When using List Category Posts whithout a category id, name or slug, it will pos
|
|
129 |
|
130 |
* **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.
|
131 |
|
|
|
|
|
132 |
* **comments** - Show comments count for each post. Default is 'no'. Ex: [catlist comments=yes].
|
133 |
|
134 |
* **thumbnail** - Show post thumbnail (http://markjaquith.wordpress.com/2009/12/23/new-in-wordpress-2-9-post-thumbnail-images/). Default is 'no'. Ex: [catlist thumbnail=yes].
|
@@ -254,6 +256,9 @@ Template system has changed. Custom templates should be stored in WordPress them
|
|
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)
|
4 |
Tags: list, categories, posts, cms
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 3.6.1
|
7 |
+
Stable tag: 0.32
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
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 |
|
129 |
|
130 |
* **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.
|
131 |
|
132 |
+
* **category_count** - Shows the posts count in that category, only works when using the **catlink** option: `[catlist name=nintendo catlink=yes category_count=yes]`
|
133 |
+
|
134 |
* **comments** - Show comments count for each post. Default is 'no'. Ex: [catlist comments=yes].
|
135 |
|
136 |
* **thumbnail** - Show post thumbnail (http://markjaquith.wordpress.com/2009/12/23/new-in-wordpress-2-9-post-thumbnail-images/). Default is 'no'. Ex: [catlist thumbnail=yes].
|
256 |
|
257 |
== Changelog ==
|
258 |
|
259 |
+
= 0.32 =
|
260 |
+
* Add category count parameter to show the number of posts in a category next to its title. Only works when using the **catlink** option: `[catlist name=nintendo catlink=yes category_count=yes]` - http://wordpress.org/support/topic/count-feature
|
261 |
+
|
262 |
= 0.31 =
|
263 |
* Pull request from @cfoellmann, adds testing environment and Travis CI integration. Awesomeness.
|
264 |
* 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)
|