Version Description
- Removes filters to order by (should fix issues with order)
- Adds
pagination_prev
andpagination_next
params to customize the "Previous" and "Next" buttons on pagination navigation. - Only show pages in pagination when they are > 1
- Adds
no_posts_text
param to display a custom message when no posts are found - Fixes "morelink" class parameter (now can be used without specifying an HTML tag and the class is applied to the a tag).
- Adds
Download this release
Release Info
Developer | fernandobt |
Plugin | List category posts |
Version | 0.43 |
Comparing to | |
See all releases |
Code changes from version 0.42.3 to 0.43
- include/CatList.php +1 -0
- include/CatListDisplayer.php +46 -34
- list_cat_posts.php +4 -1
- readme.txt +23 -4
include/CatList.php
CHANGED
@@ -151,6 +151,7 @@ class CatList{
|
|
151 |
// http://core.trac.wordpress.org/browser/tags/3.7.1/src/wp-includes/post.php#L1686
|
152 |
$args['posts_per_page'] = $args['numberposts'];
|
153 |
|
|
|
154 |
$query = new WP_Query;
|
155 |
$this->lcp_categories_posts = $query->query($args);
|
156 |
$this->posts_count = $query->found_posts;
|
151 |
// http://core.trac.wordpress.org/browser/tags/3.7.1/src/wp-includes/post.php#L1686
|
152 |
$args['posts_per_page'] = $args['numberposts'];
|
153 |
|
154 |
+
remove_all_filters('posts_orderby');
|
155 |
$query = new WP_Query;
|
156 |
$this->lcp_categories_posts = $query->query($args);
|
157 |
$this->posts_count = $query->found_posts;
|
include/CatListDisplayer.php
CHANGED
@@ -87,30 +87,25 @@ class CatListDisplayer {
|
|
87 |
|
88 |
|
89 |
//Posts loop
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
|
|
|
|
|
|
|
|
98 |
|
99 |
//Close wrapper tag
|
100 |
$this->lcp_output .= '</' . $tag . '>';
|
101 |
|
102 |
// More link
|
103 |
-
|
104 |
-
|
105 |
-
$this->lcp_output .= $this->get_morelink(
|
106 |
-
$this->params['morelink_tag'],
|
107 |
-
$this->params['morelink_class']);
|
108 |
-
else:
|
109 |
-
$this->lcp_output .= $this->get_morelink($this->params['morelink_tag']);
|
110 |
-
endif;
|
111 |
-
else:
|
112 |
-
$this->lcp_output .= $this->get_morelink();
|
113 |
-
endif;
|
114 |
|
115 |
$this->lcp_output .= $this->get_pagination();
|
116 |
}
|
@@ -122,24 +117,27 @@ class CatListDisplayer {
|
|
122 |
$pages_count = ceil (
|
123 |
$this->catlist->get_posts_count() / $this->catlist->get_number_posts()
|
124 |
);
|
125 |
-
|
126 |
-
$
|
127 |
-
|
|
|
128 |
|
129 |
-
|
130 |
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
|
136 |
-
|
137 |
|
138 |
-
|
139 |
-
|
140 |
-
|
|
|
|
|
|
|
141 |
}
|
142 |
-
$pag_output .= "</ul>";
|
143 |
endif;
|
144 |
return $pag_output;
|
145 |
}
|
@@ -373,9 +371,23 @@ class CatListDisplayer {
|
|
373 |
return $this->assign_style($info, $tag, $css_class);
|
374 |
}
|
375 |
|
376 |
-
private function get_morelink(
|
377 |
$info = $this->catlist->get_morelink();
|
378 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
379 |
}
|
380 |
|
381 |
private function get_category_count(){
|
87 |
|
88 |
|
89 |
//Posts loop
|
90 |
+
if ($this->catlist->get_posts_count() > 0) {
|
91 |
+
foreach ($this->catlist->get_categories_posts() as $single) :
|
92 |
+
if ( !post_password_required($single) ||
|
93 |
+
( post_password_required($single) && (
|
94 |
+
isset($this->params['show_protected']) &&
|
95 |
+
$this->params['show_protected'] == 'yes' ) )):
|
96 |
+
$this->lcp_output .= $this->lcp_build_post($single, $inner_tag);
|
97 |
+
endif;
|
98 |
+
endforeach;
|
99 |
+
} else {
|
100 |
+
$this->lcp_output = $this->params["no_posts_text"];
|
101 |
+
}
|
102 |
|
103 |
//Close wrapper tag
|
104 |
$this->lcp_output .= '</' . $tag . '>';
|
105 |
|
106 |
// More link
|
107 |
+
$this->lcp_output .= $this->get_morelink();
|
108 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
|
110 |
$this->lcp_output .= $this->get_pagination();
|
111 |
}
|
117 |
$pages_count = ceil (
|
118 |
$this->catlist->get_posts_count() / $this->catlist->get_number_posts()
|
119 |
);
|
120 |
+
if ($pages_count > 1){
|
121 |
+
for($i = 1; $i <= $pages_count; $i++){
|
122 |
+
$lcp_paginator .= $this->lcp_page_link($i);
|
123 |
+
}
|
124 |
|
125 |
+
$pag_output .= "<ul class='lcp_paginator'>";
|
126 |
|
127 |
+
// Add "Previous" link
|
128 |
+
if ($this->catlist->get_page() > 1){
|
129 |
+
$pag_output .= $this->lcp_page_link( intval($this->catlist->get_page()) - 1, $this->params['pagination_prev'] );
|
130 |
+
}
|
131 |
|
132 |
+
$pag_output .= $lcp_paginator;
|
133 |
|
134 |
+
// Add "Next" link
|
135 |
+
if ($this->catlist->get_page() < $pages_count){
|
136 |
+
$pag_output .= $this->lcp_page_link( intval($this->catlist->get_page()) + 1, $this->params['pagination_next']);
|
137 |
+
}
|
138 |
+
|
139 |
+
$pag_output .= "</ul>";
|
140 |
}
|
|
|
141 |
endif;
|
142 |
return $pag_output;
|
143 |
}
|
371 |
return $this->assign_style($info, $tag, $css_class);
|
372 |
}
|
373 |
|
374 |
+
private function get_morelink(){
|
375 |
$info = $this->catlist->get_morelink();
|
376 |
+
if ( !empty($this->params['morelink_tag'])){
|
377 |
+
if( !empty($this->params['morelink_class']) ){
|
378 |
+
return "<" . $this->params['morelink_tag'] . " class='" .
|
379 |
+
$this->params['morelink_class'] . "'>" . $info .
|
380 |
+
"</" . $this->params["morelink_tag"] . ">";
|
381 |
+
} else {
|
382 |
+
return "<" . $this->params['morelink_tag'] . ">" .
|
383 |
+
$info . "</" . $this->params["morelink_tag"] . ">";
|
384 |
+
}
|
385 |
+
} else{
|
386 |
+
if ( !empty($this->params['morelink_class']) ){
|
387 |
+
return str_replace("<a", "<a class='" . $this->params['morelink_class'] . "' ", $info);
|
388 |
+
}
|
389 |
+
}
|
390 |
+
return $info;
|
391 |
}
|
392 |
|
393 |
private function get_category_count(){
|
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 |
|
@@ -107,6 +107,9 @@ class ListCategoryPosts{
|
|
107 |
'search' => '',
|
108 |
'link_target' => '',
|
109 |
'pagination' => 'no',
|
|
|
|
|
|
|
110 |
'instance' => '0'
|
111 |
), $atts);
|
112 |
if( $atts['numberposts'] == ''){
|
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.43
|
7 |
Author: Fernando Briano
|
8 |
Author URI: http://picandocodigo.net/
|
9 |
|
107 |
'search' => '',
|
108 |
'link_target' => '',
|
109 |
'pagination' => 'no',
|
110 |
+
'pagination_next' => '>>',
|
111 |
+
'pagination_prev' => '<<',
|
112 |
+
'no_posts_text' => "No posts found",
|
113 |
'instance' => '0'
|
114 |
), $atts);
|
115 |
if( $atts['numberposts'] == ''){
|
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.8
|
7 |
-
Stable tag: 0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -107,6 +107,14 @@ Example:
|
|
107 |
|
108 |
`[catlist id=5 numberposts=15 pagination=yes instance=2]`
|
109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
==Changing the pagination CSS==
|
111 |
|
112 |
If you want to customize the way the pagination is displayed, you can
|
@@ -150,6 +158,8 @@ update the plugin.
|
|
150 |
You can set the default number of posts globally on the options
|
151 |
page on your Dashboard in Settings / List Category Posts.
|
152 |
|
|
|
|
|
153 |
* **monthnum** and **year** - List posts from a certain year or month. You can use these together or independently. Example: `[catlist year=2015]` will list posts from the year 2015. `[catlist monthnum=8]` will list posts published in August of every year. `[catlist year=2012 monthnum=12]` will list posts from December 2012.
|
154 |
|
155 |
* **search** - List posts that match a search term. `[catlist search="The Cake is a lie"]`
|
@@ -385,6 +395,16 @@ Template system has changed. Custom templates should be stored in WordPress them
|
|
385 |
|
386 |
== Changelog ==
|
387 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
388 |
= 0.42.3 =
|
389 |
* Adds missing title attribute from thumbnail links.
|
390 |
|
@@ -404,7 +424,6 @@ Template system has changed. Custom templates should be stored in WordPress them
|
|
404 |
* Small bugfix with customfield_display_name (wasn't working now it
|
405 |
is)
|
406 |
|
407 |
-
|
408 |
= 0.41.1 =
|
409 |
* Fixes customfield display name.
|
410 |
* Fixes size in getting thumbnails, now checks for all available
|
@@ -429,7 +448,7 @@ Template system has changed. Custom templates should be stored in WordPress them
|
|
429 |
* Removes unnecessary stuff on wp_enqueue_styles
|
430 |
* Fixes validation when using quotes in title
|
431 |
* Fixes on <!--more--> tag
|
432 |
-
* Fixes on title HTML tag and CSS class. (*See HTML &
|
433 |
Customization* on [Other Notes](http://wordpress.org/plugins/list-category-posts/other_notes/) to check the expected behaviour)
|
434 |
|
435 |
= 0.39 =
|
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.8.1
|
7 |
+
Stable tag: 0.43
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
107 |
|
108 |
`[catlist id=5 numberposts=15 pagination=yes instance=2]`
|
109 |
|
110 |
+
You can customize what to show for the "next" and "previous" buttons
|
111 |
+
in the pagination navigation. Use the following params:
|
112 |
+
|
113 |
+
* **pagination_prev** - Replace the "<<" characters in the "previous"
|
114 |
+
button in the pagination navigation with a custom text.
|
115 |
+
* **pagination_next** - Replace the ">>" characters in the "next"
|
116 |
+
button in the pagination navigation with a custom text.
|
117 |
+
|
118 |
==Changing the pagination CSS==
|
119 |
|
120 |
If you want to customize the way the pagination is displayed, you can
|
158 |
You can set the default number of posts globally on the options
|
159 |
page on your Dashboard in Settings / List Category Posts.
|
160 |
|
161 |
+
* **no_posts_text** - Text to display when no posts are found.
|
162 |
+
|
163 |
* **monthnum** and **year** - List posts from a certain year or month. You can use these together or independently. Example: `[catlist year=2015]` will list posts from the year 2015. `[catlist monthnum=8]` will list posts published in August of every year. `[catlist year=2012 monthnum=12]` will list posts from December 2012.
|
164 |
|
165 |
* **search** - List posts that match a search term. `[catlist search="The Cake is a lie"]`
|
395 |
|
396 |
== Changelog ==
|
397 |
|
398 |
+
= 0.43 =
|
399 |
+
* Removes filters to order by (should fix issues with order)
|
400 |
+
* Adds `pagination_prev` and `pagination_next` params to customize
|
401 |
+
the "Previous" and "Next" buttons on pagination navigation.
|
402 |
+
* Only show pages in pagination when they are > 1
|
403 |
+
* Adds `no_posts_text` param to display a custom message when no
|
404 |
+
posts are found
|
405 |
+
* Fixes "morelink" class parameter (now can be used without
|
406 |
+
specifying an HTML tag and the class is applied to the a tag).
|
407 |
+
|
408 |
= 0.42.3 =
|
409 |
* Adds missing title attribute from thumbnail links.
|
410 |
|
424 |
* Small bugfix with customfield_display_name (wasn't working now it
|
425 |
is)
|
426 |
|
|
|
427 |
= 0.41.1 =
|
428 |
* Fixes customfield display name.
|
429 |
* Fixes size in getting thumbnails, now checks for all available
|
448 |
* Removes unnecessary stuff on wp_enqueue_styles
|
449 |
* Fixes validation when using quotes in title
|
450 |
* Fixes on <!--more--> tag
|
451 |
+
* Fixes on title HTML tag and CSS class. (*See HTML & CSS
|
452 |
Customization* on [Other Notes](http://wordpress.org/plugins/list-category-posts/other_notes/) to check the expected behaviour)
|
453 |
|
454 |
= 0.39 =
|