Version Description
- Adds "the_excerpt" filter to excerpt to improve compatibility with
the Jetpack plugin.
- Add character limit to title
- Removes debug warnings
- Output valid HTML, attribute quotations - thanks Nikolaus Demmel!
Download this release
Release Info
Developer | fernandobt |
Plugin | List category posts |
Version | 0.46 |
Comparing to | |
See all releases |
Code changes from version 0.45 to 0.46
- include/CatList.php +17 -4
- include/CatListDisplayer.php +16 -8
- list_cat_posts.php +2 -1
- readme.txt +12 -1
include/CatList.php
CHANGED
@@ -121,8 +121,12 @@ class CatList{
|
|
121 |
$args['tag__not_in'] = $tag_ids;
|
122 |
endif;
|
123 |
|
|
|
124 |
if ( $this->lcp_not_empty('currenttags') && $this->params['currenttags'] == "yes" ):
|
125 |
-
$
|
|
|
|
|
|
|
126 |
endif;
|
127 |
|
128 |
// Added custom taxonomy support
|
@@ -164,6 +168,13 @@ class CatList{
|
|
164 |
$this->posts_count = $query->found_posts;
|
165 |
}
|
166 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
private function lcp_not_empty($param){
|
168 |
if ( ( isset($this->params[$param]) ) &&
|
169 |
( !empty($this->params[$param]) ) &&
|
@@ -427,11 +438,12 @@ class CatList{
|
|
427 |
}
|
428 |
|
429 |
public function get_excerpt($single){
|
430 |
-
if ($this->params['excerpt']=='yes' &&
|
431 |
-
|
432 |
$single->post_content) ):
|
433 |
|
434 |
-
if($single->post_excerpt && $this->params['excerpt_overwrite']
|
|
|
435 |
return $lcp_excerpt = $this->lcp_trim_excerpt($single->post_excerpt);
|
436 |
endif;
|
437 |
|
@@ -446,6 +458,7 @@ class CatList{
|
|
446 |
|
447 |
$text = strip_shortcodes($text);
|
448 |
$text = apply_filters('the_content', $text);
|
|
|
449 |
$text = str_replace(']]>',']]>', $text);
|
450 |
|
451 |
if( $this->lcp_not_empty('excerpt_strip') &&
|
121 |
$args['tag__not_in'] = $tag_ids;
|
122 |
endif;
|
123 |
|
124 |
+
// Current tags
|
125 |
if ( $this->lcp_not_empty('currenttags') && $this->params['currenttags'] == "yes" ):
|
126 |
+
$tags = $this->lcp_get_current_tags();
|
127 |
+
if ( !empty($tags) ):
|
128 |
+
$args['tag__in'] = $tags;
|
129 |
+
endif;
|
130 |
endif;
|
131 |
|
132 |
// Added custom taxonomy support
|
168 |
$this->posts_count = $query->found_posts;
|
169 |
}
|
170 |
|
171 |
+
/* Should I return posts or show that the tag/category or whatever
|
172 |
+
posts combination that I called has no posts? By default I've
|
173 |
+
always returned the latest posts because that's what the query
|
174 |
+
does when the params are "wrong". But could make for a better user
|
175 |
+
experience if I returned an empty list in certain cases.
|
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]) ) &&
|
438 |
}
|
439 |
|
440 |
public function get_excerpt($single){
|
441 |
+
if ( !empty($this->params['excerpt']) && $this->params['excerpt']=='yes' &&
|
442 |
+
!empty($this->params['content']) && !($this->params['content']=='yes' &&
|
443 |
$single->post_content) ):
|
444 |
|
445 |
+
if($single->post_excerpt && !empty($this->params['excerpt_overwrite']) &&
|
446 |
+
$this->params['excerpt_overwrite'] != 'yes'):
|
447 |
return $lcp_excerpt = $this->lcp_trim_excerpt($single->post_excerpt);
|
448 |
endif;
|
449 |
|
458 |
|
459 |
$text = strip_shortcodes($text);
|
460 |
$text = apply_filters('the_content', $text);
|
461 |
+
$text = apply_filters('the_excerpt', $text);
|
462 |
$text = str_replace(']]>',']]>', $text);
|
463 |
|
464 |
if( $this->lcp_not_empty('excerpt_strip') &&
|
include/CatListDisplayer.php
CHANGED
@@ -85,7 +85,7 @@ class CatListDisplayer {
|
|
85 |
}
|
86 |
|
87 |
$this->lcp_output .= '>';
|
88 |
-
$inner_tag = ($tag ==
|
89 |
|
90 |
//Posts loop
|
91 |
foreach ($this->catlist->get_categories_posts() as $single) :
|
@@ -337,8 +337,16 @@ class CatListDisplayer {
|
|
337 |
}
|
338 |
|
339 |
private function get_post_title($single){
|
340 |
-
$info = '<a href="' . get_permalink($single->ID)
|
341 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
342 |
|
343 |
if (!empty($this->params['link_target'])):
|
344 |
$info .= ' target="' . $this->params['link_target'] . '" ';
|
@@ -346,11 +354,11 @@ class CatListDisplayer {
|
|
346 |
|
347 |
if ( !empty($this->params['title_class'] ) &&
|
348 |
empty($this->params['title_tag']) ):
|
349 |
-
$info .= ' class=' . $this->params['title_class'];
|
350 |
endif;
|
351 |
|
352 |
|
353 |
-
$info .= '>' .
|
354 |
|
355 |
if( !empty($this->params['post_suffix']) ):
|
356 |
$info .= " " . $this->params['post_suffix'];
|
@@ -359,9 +367,9 @@ class CatListDisplayer {
|
|
359 |
if (!empty($this->params['title_tag'])){
|
360 |
$pre = "<" . $this->params['title_tag'];
|
361 |
if (!empty($this->params['title_class'])){
|
362 |
-
$pre .=
|
363 |
}
|
364 |
-
$pre .= ">
|
365 |
$post = "</" . $this->params['title_tag'] . ">";
|
366 |
$info = $pre . $info . $post;
|
367 |
}
|
@@ -418,4 +426,4 @@ class CatListDisplayer {
|
|
418 |
return '<' . $tag . ' class="' . $css_class . '">' . $info . '</' . $tag . '>';
|
419 |
endif;
|
420 |
}
|
421 |
-
}
|
85 |
}
|
86 |
|
87 |
$this->lcp_output .= '>';
|
88 |
+
$inner_tag = ( ($tag == 'ul') || ($tag == 'ol') ) ? 'li' : 'p';
|
89 |
|
90 |
//Posts loop
|
91 |
foreach ($this->catlist->get_categories_posts() as $single) :
|
337 |
}
|
338 |
|
339 |
private function get_post_title($single){
|
340 |
+
$info = '<a href="' . get_permalink($single->ID);
|
341 |
+
|
342 |
+
$lcp_post_title = apply_filters('the_title', $single->post_title, $single->ID);
|
343 |
+
|
344 |
+
if ( !empty($this->params['title_limit']) && $this->params['title_limit'] != "0" ):
|
345 |
+
$lcp_post_title = substr($lcp_post_title, 0, intval($this->params['title_limit'])) .
|
346 |
+
"…";
|
347 |
+
endif;
|
348 |
+
|
349 |
+
$info.= '" title="' . wptexturize($single->post_title) . '"';
|
350 |
|
351 |
if (!empty($this->params['link_target'])):
|
352 |
$info .= ' target="' . $this->params['link_target'] . '" ';
|
354 |
|
355 |
if ( !empty($this->params['title_class'] ) &&
|
356 |
empty($this->params['title_tag']) ):
|
357 |
+
$info .= ' class="' . $this->params['title_class'] . '"';
|
358 |
endif;
|
359 |
|
360 |
|
361 |
+
$info .= '>' . $lcp_post_title . '</a>';
|
362 |
|
363 |
if( !empty($this->params['post_suffix']) ):
|
364 |
$info .= " " . $this->params['post_suffix'];
|
367 |
if (!empty($this->params['title_tag'])){
|
368 |
$pre = "<" . $this->params['title_tag'];
|
369 |
if (!empty($this->params['title_class'])){
|
370 |
+
$pre .= ' class="' . $this->params['title_class'];
|
371 |
}
|
372 |
+
$pre .= '">';
|
373 |
$post = "</" . $this->params['title_tag'] . ">";
|
374 |
$info = $pre . $info . $post;
|
375 |
}
|
426 |
return '<' . $tag . ' class="' . $css_class . '">' . $info . '</' . $tag . '>';
|
427 |
endif;
|
428 |
}
|
429 |
+
}
|
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 |
|
@@ -83,6 +83,7 @@ class ListCategoryPosts{
|
|
83 |
'thumbnail_class' => '',
|
84 |
'title_tag' => '',
|
85 |
'title_class' => '',
|
|
|
86 |
'post_type' => '',
|
87 |
'post_status' => '',
|
88 |
'post_parent' => '0',
|
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
|
7 |
Author: Fernando Briano
|
8 |
Author URI: http://picandocodigo.net/
|
9 |
|
83 |
'thumbnail_class' => '',
|
84 |
'title_tag' => '',
|
85 |
'title_class' => '',
|
86 |
+
'title_limit' => '0',
|
87 |
'post_type' => '',
|
88 |
'post_status' => '',
|
89 |
'post_parent' => '0',
|
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.8.1
|
7 |
-
Stable tag: 0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -190,6 +190,10 @@ update the plugin.
|
|
190 |
|
191 |
* **excerpt_strip** - Set it to `yes` to strip the excerpt's HTML tags.
|
192 |
|
|
|
|
|
|
|
|
|
193 |
* **excludeposts** - IDs of posts to exclude from the list. Use 'this' to exclude the current post. Ex: `[catlist excludeposts=this,12,52,37]`
|
194 |
|
195 |
* **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.
|
@@ -429,6 +433,13 @@ Template system has changed. Custom templates should be stored in WordPress them
|
|
429 |
|
430 |
== Changelog ==
|
431 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
432 |
= 0.45 =
|
433 |
* Adds ol default template to `template` parameter.
|
434 |
* Improves documentation.
|
4 |
Tags: list, categories, posts, cms
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 3.8.1
|
7 |
+
Stable tag: 0.46
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
190 |
|
191 |
* **excerpt_strip** - Set it to `yes` to strip the excerpt's HTML tags.
|
192 |
|
193 |
+
* **title_limit** - Set the limit of characters for the title. Ex:
|
194 |
+
`[catlist id=2 title_limit=50]` will show only the first 50
|
195 |
+
characters of the title and add "…" at the end.
|
196 |
+
|
197 |
* **excludeposts** - IDs of posts to exclude from the list. Use 'this' to exclude the current post. Ex: `[catlist excludeposts=this,12,52,37]`
|
198 |
|
199 |
* **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.
|
433 |
|
434 |
== Changelog ==
|
435 |
|
436 |
+
= 0.46 =
|
437 |
+
* Adds "the_excerpt" filter to excerpt to improve compatibility with
|
438 |
+
the [Jetpack](http://wordpress.org/plugins/jetpack/) plugin.
|
439 |
+
* Add character limit to title
|
440 |
+
* Removes debug warnings
|
441 |
+
* Output valid HTML, attribute quotations - thanks Nikolaus Demmel!
|
442 |
+
|
443 |
= 0.45 =
|
444 |
* Adds ol default template to `template` parameter.
|
445 |
* Improves documentation.
|