Version Description
- Fixed customfield_class and customfield_tag issues. Thanks vacuus!!
- Tested up to WordPress 4.6.1
- Added date range, thanks again vacuus!! Check the docs to read how to use this.
Download this release
Release Info
Developer | fernandobt |
Plugin | List category posts |
Version | 0.70 |
Comparing to | |
See all releases |
Code changes from version 0.69 to 0.70
- include/lcp-catlistdisplayer.php +10 -3
- include/lcp-parameters.php +156 -1
- list-category-posts.php +9 -1
- readme.txt +39 -114
include/lcp-catlistdisplayer.php
CHANGED
@@ -234,7 +234,6 @@ class CatListDisplayer {
|
|
234 |
* @return string
|
235 |
*/
|
236 |
private function lcp_build_post($single, $tag){
|
237 |
-
|
238 |
$class ='';
|
239 |
if ( is_object($this->parent) && is_object($single) && $this->parent->ID == $single->ID ){
|
240 |
$class = ' class="current" ';
|
@@ -395,10 +394,18 @@ class CatListDisplayer {
|
|
395 |
private function get_custom_fields($single){
|
396 |
if(!empty($this->params['customfield_display'])){
|
397 |
$info = $this->catlist->get_custom_fields($this->params['customfield_display'], $single->ID);
|
398 |
-
if(empty($this->params['customfield_tag']) || $this->params['customfield_tag'] == null)
|
399 |
$tag = 'div';
|
400 |
-
|
|
|
|
|
|
|
|
|
401 |
$css_class = 'lcp_customfield';
|
|
|
|
|
|
|
|
|
402 |
$final_info = '';
|
403 |
if(!is_array($info)){
|
404 |
$final_info = $this->assign_style($info, $tag, $css_class);
|
234 |
* @return string
|
235 |
*/
|
236 |
private function lcp_build_post($single, $tag){
|
|
|
237 |
$class ='';
|
238 |
if ( is_object($this->parent) && is_object($single) && $this->parent->ID == $single->ID ){
|
239 |
$class = ' class="current" ';
|
394 |
private function get_custom_fields($single){
|
395 |
if(!empty($this->params['customfield_display'])){
|
396 |
$info = $this->catlist->get_custom_fields($this->params['customfield_display'], $single->ID);
|
397 |
+
if(empty($this->params['customfield_tag']) || $this->params['customfield_tag'] == null){
|
398 |
$tag = 'div';
|
399 |
+
} else {
|
400 |
+
$tag = $this->params['customfield_tag'];
|
401 |
+
}
|
402 |
+
|
403 |
+
if(empty($this->params['customfield_class']) || $this->params['customfield_class'] == null){
|
404 |
$css_class = 'lcp_customfield';
|
405 |
+
} else {
|
406 |
+
$css_class = $this->params['customfield_class'];
|
407 |
+
}
|
408 |
+
|
409 |
$final_info = '';
|
410 |
if(!is_array($info)){
|
411 |
$final_info = $this->assign_style($info, $tag, $css_class);
|
include/lcp-parameters.php
CHANGED
@@ -5,6 +5,8 @@ class LcpParameters{
|
|
5 |
// Singleton implementation
|
6 |
private static $instance = null;
|
7 |
private $starting_with = null;
|
|
|
|
|
8 |
private $utils;
|
9 |
private $params;
|
10 |
|
@@ -59,6 +61,64 @@ class LcpParameters{
|
|
59 |
$args['author_name'] = $params['author_posts'];
|
60 |
endif;
|
61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
/*
|
63 |
* Custom fields 'customfield_name' & 'customfield_value'
|
64 |
* should both be defined
|
@@ -192,4 +252,99 @@ class LcpParameters{
|
|
192 |
global $post;
|
193 |
return $post->ID;
|
194 |
}
|
195 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
// Singleton implementation
|
6 |
private static $instance = null;
|
7 |
private $starting_with = null;
|
8 |
+
// $date_query tells us if we need to generate date_query args
|
9 |
+
private $date_query = false;
|
10 |
private $utils;
|
11 |
private $params;
|
12 |
|
61 |
$args['author_name'] = $params['author_posts'];
|
62 |
endif;
|
63 |
|
64 |
+
// Posts within given date range:
|
65 |
+
if ( $this->utils->lcp_not_empty('after') ) {
|
66 |
+
$this->after = $params['after'];
|
67 |
+
$date_query = true;
|
68 |
+
}
|
69 |
+
|
70 |
+
if ( $this->utils->lcp_not_empty('after_year') ) {
|
71 |
+
$this->after_year = $params['after_year'];
|
72 |
+
$date_query = true;
|
73 |
+
}
|
74 |
+
|
75 |
+
if ( $this->utils->lcp_not_empty('after_month') ) {
|
76 |
+
// after_month should be in the range [1, 12]
|
77 |
+
if ($params['after_month'] >= 1 && $params['after_month'] <= 12) {
|
78 |
+
$this->after_month = $params['after_month'];
|
79 |
+
$date_query = true;
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
83 |
+
if ( $this->utils->lcp_not_empty('after_day') ) {
|
84 |
+
// after_day should be in the range [1, 31]
|
85 |
+
if ($params['after_day'] >= 1 && $params['after_day'] <= 31) {
|
86 |
+
$this->after_day = $params['after_day'];
|
87 |
+
$date_query = true;
|
88 |
+
}
|
89 |
+
}
|
90 |
+
|
91 |
+
if ( $this->utils->lcp_not_empty('before') ) {
|
92 |
+
$this->before = $params['before'];
|
93 |
+
$date_query = true;
|
94 |
+
}
|
95 |
+
|
96 |
+
if ( $this->utils->lcp_not_empty('before_year') ) {
|
97 |
+
$this->before_year = $params['before_year'];
|
98 |
+
$date_query = true;
|
99 |
+
}
|
100 |
+
|
101 |
+
if ( $this->utils->lcp_not_empty('before_month') ) {
|
102 |
+
// before_month should be in the range [1, 12]
|
103 |
+
if ($params['before_month'] >= 1 && $params['before_month'] <= 12) {
|
104 |
+
$this->before_month = $params['before_month'];
|
105 |
+
$date_query = true;
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
+
if ( $this->utils->lcp_not_empty('before_day') ) {
|
110 |
+
// before_day should be in the range [1, 31]
|
111 |
+
if ($params['before_day'] >= 1 && $params['before_day'] <= 31) {
|
112 |
+
$this->before_day = $params['before_day'];
|
113 |
+
$date_query = true;
|
114 |
+
}
|
115 |
+
}
|
116 |
+
|
117 |
+
// Only generate date_query args if a before/after paramater was found
|
118 |
+
if (isset($date_query) ){
|
119 |
+
$args['date_query'] = $this->create_date_query_args();
|
120 |
+
}
|
121 |
+
|
122 |
/*
|
123 |
* Custom fields 'customfield_name' & 'customfield_value'
|
124 |
* should both be defined
|
252 |
global $post;
|
253 |
return $post->ID;
|
254 |
}
|
255 |
+
|
256 |
+
/*
|
257 |
+
* Create date_query args according to https://codex.wordpress.org/Class_Reference/WP_Query#Date_Parameters
|
258 |
+
* There's probably a better way to check if values exist.
|
259 |
+
* Code should be cleaned up (this is first attempt at a solution).
|
260 |
+
*/
|
261 |
+
private function create_date_query_args() {
|
262 |
+
$date_query = array();
|
263 |
+
|
264 |
+
// Keep track of parameters that are set to build the argument array.
|
265 |
+
$params_set = array(
|
266 |
+
'after' => false,
|
267 |
+
'after_year' => false,
|
268 |
+
'after_month' => false,
|
269 |
+
'after_day' => false,
|
270 |
+
'before' => false,
|
271 |
+
'before_year' => false,
|
272 |
+
'before_month' => false,
|
273 |
+
'before_day' => false,
|
274 |
+
);
|
275 |
+
|
276 |
+
// Booleans to track which subarrays should be created.
|
277 |
+
$after = false;
|
278 |
+
$before = false;
|
279 |
+
|
280 |
+
/*
|
281 |
+
* Check which paramaters are set and find out which subarrays
|
282 |
+
* should be created.
|
283 |
+
*/
|
284 |
+
if ( isset($this->after) ) {
|
285 |
+
$params_set['after'] = true;
|
286 |
+
$after = true;
|
287 |
+
}
|
288 |
+
|
289 |
+
if ( isset($this->after_year) ) {
|
290 |
+
$params_set['after_year'] = true;
|
291 |
+
$after = true;
|
292 |
+
}
|
293 |
+
|
294 |
+
if ( isset($this->after_month) ) {
|
295 |
+
$params_set['after_month'] = true;
|
296 |
+
$after = true;
|
297 |
+
}
|
298 |
+
|
299 |
+
if ( isset($this->after_day) ) {
|
300 |
+
$params_set['after_day'] = true;
|
301 |
+
$after = true;
|
302 |
+
}
|
303 |
+
|
304 |
+
if ( isset($this->before) ) {
|
305 |
+
$params_set['before'] = true;
|
306 |
+
$before = true;
|
307 |
+
}
|
308 |
+
|
309 |
+
if ( isset($this->before_year) ) {
|
310 |
+
$params_set['before_year'] = true;
|
311 |
+
$before = true;
|
312 |
+
}
|
313 |
+
|
314 |
+
if ( isset($this->before_month) ) {
|
315 |
+
$params_set['before_month'] = true;
|
316 |
+
$before = true;
|
317 |
+
}
|
318 |
+
|
319 |
+
if ( isset($this->before_day) ) {
|
320 |
+
$params_set['before_day'] = true;
|
321 |
+
$before = true;
|
322 |
+
}
|
323 |
+
|
324 |
+
/*
|
325 |
+
* Build the subarrays.
|
326 |
+
* The after parameter takes priority over after_* parameters.
|
327 |
+
* Simlarly, the before parameter takes priority over before_* parameters.
|
328 |
+
*/
|
329 |
+
if ($after) {
|
330 |
+
if ($params_set['after']) {
|
331 |
+
$date_query['after'] = $this->after;
|
332 |
+
} else {
|
333 |
+
if ( $params_set['after_year'] ) $date_query['after']['year'] = $this->after_year;
|
334 |
+
if ( $params_set['after_month'] ) $date_query['after']['month'] = $this->after_month;
|
335 |
+
if ( $params_set['after_day'] ) $date_query['after']['day'] = $this->after_day;
|
336 |
+
}
|
337 |
+
}
|
338 |
+
|
339 |
+
if ($before) {
|
340 |
+
if ($params_set['before']) {
|
341 |
+
$date_query['before'] = $this->before;
|
342 |
+
} else {
|
343 |
+
if ( $params_set['before_year'] ) $date_query['before']['year'] = $this->before_year;
|
344 |
+
if ( $params_set['before_month'] ) $date_query['before']['month'] = $this->before_month;
|
345 |
+
if ( $params_set['before_day'] ) $date_query['before']['day'] = $this->before_day;
|
346 |
+
}
|
347 |
+
}
|
348 |
+
return $date_query;
|
349 |
+
}
|
350 |
+
}
|
list-category-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 by category in 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, the number of posts to display and many more parameters. 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://fernandobriano.com
|
9 |
|
@@ -132,6 +132,14 @@ class ListCategoryPosts{
|
|
132 |
'no_post_titles' => 'no',
|
133 |
'link_titles' => true,
|
134 |
'link_dates' => 'no',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
), $atts);
|
136 |
if($atts['numberposts'] == ''){
|
137 |
$atts['numberposts'] = get_option('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 by category in 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, the number of posts to display and many more parameters. You can use [catlist] as many times as needed with different arguments. Usage: [catlist argument1=value1 argument2=value2].
|
6 |
+
Version: 0.70
|
7 |
Author: Fernando Briano
|
8 |
Author URI: http://fernandobriano.com
|
9 |
|
132 |
'no_post_titles' => 'no',
|
133 |
'link_titles' => true,
|
134 |
'link_dates' => 'no',
|
135 |
+
'after' => '',
|
136 |
+
'after_year' => '',
|
137 |
+
'after_month' => '',
|
138 |
+
'after_day' => '',
|
139 |
+
'before' => '',
|
140 |
+
'before_year' => '',
|
141 |
+
'before_month' => '',
|
142 |
+
'before_day' => '',
|
143 |
), $atts);
|
144 |
if($atts['numberposts'] == ''){
|
145 |
$atts['numberposts'] = get_option('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: 4.
|
7 |
-
Stable tag: 0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -24,7 +24,7 @@ want the posts to display, and the number of posts to display. You can
|
|
24 |
also display the post author, date, excerpt, custom field values, even
|
25 |
the content! A lot of parameters have been added to customize what to
|
26 |
display and how to show it. Check [the full
|
27 |
-
documentation](https://
|
28 |
to learn about the different ways to use it.
|
29 |
|
30 |
The `[catlist]` shortcode can be used as many times as needed with
|
@@ -38,7 +38,7 @@ parameter, to define a default number of posts to show for each
|
|
38 |
instance (you can override this value by using the `numberposts`
|
39 |
parameter in your shortcode).
|
40 |
|
41 |
-
**[Read the instructions](
|
42 |
|
43 |
If you want to **List Categories** instead of posts you can use my other plugin **[List categories](http://wordpress.org/plugins/list-categories/)**.
|
44 |
|
@@ -46,7 +46,7 @@ You can find **Frequently Asked Questions** [here](https://github.com/picandocod
|
|
46 |
|
47 |
**Customization**
|
48 |
|
49 |
-
The different elements to display can be styled with CSS. you can define an HTML tag to wrap the element with, and a CSS class for this tag. Check [
|
50 |
|
51 |
Great to use WordPress as a CMS, and create pages with several categories posts.
|
52 |
|
@@ -58,8 +58,7 @@ available options from the Appearence > Widgets page. Not all the
|
|
58 |
functionality in the shortcode has been implemented in the widget
|
59 |
yet. You can use the shortcode for the most flexibility.
|
60 |
|
61 |
-
Please, read the information on [
|
62 |
-
Notes](http://wordpress.org/extend/plugins/list-category-posts/other_notes/)
|
63 |
and
|
64 |
[Changelog](http://wordpress.org/extend/plugins/list-category-posts/changelog/)
|
65 |
to be aware of new functionality, and improvements to the plugin.
|
@@ -85,11 +84,14 @@ Development is being tracked on [GitHub](https://github.com/picandocodigo/List-C
|
|
85 |
|
86 |
* Upload the `list-category-posts` directory to your wp-content/plugins/ directory.
|
87 |
* Login to your WordPress Admin menu, go to Plugins, and activate it.
|
|
|
88 |
* You can find the List Category Posts widget in the Appearence > Widgets section on your WordPress Dashboard.
|
89 |
-
* If you want to customize the way the plugin displays the information, check the section on Templates on
|
90 |
|
91 |
==Other notes==
|
92 |
|
|
|
|
|
93 |
==Instructions on how to use the plugin==
|
94 |
|
95 |
==SELECTING THE CATEGORY==
|
@@ -132,6 +134,21 @@ When using List Category Posts whithout a category id, name or slug, it will pos
|
|
132 |
|
133 |
* **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.
|
134 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
* **search** - List posts that match a search term. `[catlist search="The Cake is a lie"]`
|
136 |
|
137 |
* **excludeposts** - IDs of posts to exclude from the list. Use 'this' to exclude the current post. Ex: `[catlist excludeposts=this,12,52,37]`
|
@@ -160,54 +177,9 @@ When using List Category Posts whithout a category id, name or slug, it will pos
|
|
160 |
|
161 |
* **custom fields** - To use custom fields, you must specify two values: customfield_name and customfield_value. Using this only show posts that contain a custom field with this name and value. Both parameters must be defined, or neither will work.
|
162 |
|
163 |
-
==PAGINATION
|
164 |
-
|
165 |
-
To use pagination, you need to set the following parameters in the shortcode:
|
166 |
-
|
167 |
-
* **pagination** set it to yes. `[catlist pagination=yes]`
|
168 |
-
|
169 |
-
* **numberposts** - Posts per page are set with the `numberposts`
|
170 |
-
parameter. `[catlist pagination=yes numberposts=5]`
|
171 |
-
|
172 |
-
* **instance** (only necessary when using the shortcode with
|
173 |
-
pagination more than once in the same page/post) - a number or
|
174 |
-
name to identify the instance where you are using pagination.
|
175 |
-
Since you can use the shortcode several times in the same page or
|
176 |
-
post, you need to identify the instance so that you paginate only
|
177 |
-
that instance.
|
178 |
-
|
179 |
-
|
180 |
-
Example:
|
181 |
-
|
182 |
-
`[catlist id=3 numberposts=5 pagination=yes instance=1]`
|
183 |
|
184 |
-
|
185 |
-
|
186 |
-
You can customize what to show for the "next" and "previous" buttons
|
187 |
-
in the pagination navigation. Use the following params:
|
188 |
-
|
189 |
-
* **pagination_prev** - Replace the "<<" characters in the "previous"
|
190 |
-
button in the pagination navigation with a custom text.
|
191 |
-
* **pagination_next** - Replace the ">>" characters in the "next"
|
192 |
-
button in the pagination navigation with a custom text.
|
193 |
-
|
194 |
-
You can also set a default value for pagination in the Options Page. This will apply every time you use the shortcode. You can override the option by using `pagination='yes'` and `pagination='no'` in the shortcode.
|
195 |
-
|
196 |
-
==Changing the pagination CSS==
|
197 |
-
|
198 |
-
If you want to customize the way the pagination is displayed, you can
|
199 |
-
copy the `lcp_paginator.css` file from the plugin's directory to your
|
200 |
-
theme's directory and customize it. Do not customize the file on the
|
201 |
-
plugin's directory since this file will be overwritten every time you
|
202 |
-
update the plugin.
|
203 |
-
|
204 |
-
The current page in pagination has its own CSS class:
|
205 |
-
|
206 |
-
`
|
207 |
-
<li class='lcp_currentpage'>current_page</li>
|
208 |
-
`
|
209 |
-
|
210 |
-
So you can style the current page number differently if you want to.
|
211 |
|
212 |
==OTHER PARAMETERS==
|
213 |
|
@@ -297,9 +269,9 @@ So you can style the current page number differently if you want to.
|
|
297 |
|
298 |
* **content** - **WARNING**: If you want to show the content on your listed posts, you might want to do this from a new [Page Template](http://codex.wordpress.org/Page_Templates) or a [Custom Post Type](http://codex.wordpress.org/Post_Types#Custom_Post_Type_Templates) template. Using this parameter is discouraged, you can have memory issues as well as infinite loop situations when you're displaying a post that's using List Category Posts. You have been warned. Usage:
|
299 |
|
300 |
-
Show the excerpt or full content of the post. If there's a <!--more--> 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]`
|
301 |
|
302 |
-
Show the full content of the post regardless of whether there is a <!--more--> tag in the post. Ex: `[catlist content=full]`
|
303 |
|
304 |
* **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.
|
305 |
|
@@ -409,64 +381,11 @@ Then just add a new text widget to your blog and use the shortcode there as the
|
|
409 |
|
410 |
== HTML & CSS Customization ==
|
411 |
|
412 |
-
|
413 |
-
`lcp_catlist` CSS class, like this:
|
414 |
-
|
415 |
-
`<ul class="lcp_catlist">`
|
416 |
-
|
417 |
-
So if you want to customize the appearance of the List Category Posts
|
418 |
-
lists, you can just edit the lcp_catlist class in your theme's CSS.
|
419 |
-
|
420 |
-
You can also customize what HTML tags different elements will be
|
421 |
-
surrounded with, and set a CSS class for this element, or just a CSS class
|
422 |
-
which will wrap the element with a `span` tag.
|
423 |
-
|
424 |
-
The customizable elements (so far) are: author, catlink (category link), comments, date, excerpt, morelink ("Read More" link), thumbnail and title (post title).
|
425 |
-
|
426 |
-
The parameters are:
|
427 |
-
`author_tag, author_class, catlink_tag, catlink_class, comments_tag,
|
428 |
-
comments_class, date_tag, date_class, date_modified_tag,
|
429 |
-
date_modified_class, excerpt_tag, excerpt_class, morelink_class,
|
430 |
-
thumbnail_class, title_tag, title_class, posts_morelink_class,
|
431 |
-
customfield_tag, customfield_class`
|
432 |
-
|
433 |
-
So let's say you want to wrap the displayed comments count with the p tag and a "lcp_comments" class, you would do:
|
434 |
-
`[catlist id=7 comments=yes comments_tag=p comments_class=lcp_comments]`
|
435 |
-
This would produce the following code:
|
436 |
-
`<p class="lcp_comments"> (3)</p>`
|
437 |
-
|
438 |
-
Or you just want to style the displayed date, you could wrap it with a span tag:
|
439 |
-
`[catlist name=blog date=yes date_tag=span date_class=lcp_date]`
|
440 |
-
This would produce the following code:
|
441 |
-
`<span class="lcp_date">March 21, 2011</span>`
|
442 |
-
|
443 |
-
Elements without a specified tag, but a specified class, will be wrapped with a span tag and its class. For example this:
|
444 |
-
`[catlist id=7 date=yes date_class="lcp_date"]`
|
445 |
-
Will produce the following:
|
446 |
-
`<span class="lcp_date">October 23, 2013</span>`
|
447 |
-
|
448 |
-
The only exceptions here are the **title_tag** and **title_class**
|
449 |
-
parameters. If you only use the **title_class** parameter, the CSS
|
450 |
-
class will be assigned to the `a` tag like this:
|
451 |
-
`[catlist id=1 title_class="lcp_title"]`
|
452 |
-
Will produce:
|
453 |
-
`<a href="http://127.0.0.1/wordpress/?p=38" title="Test" class="lcp_title">Test</a>`
|
454 |
-
But if you use both:
|
455 |
-
`[catlist numberposts=5 title_class=lcp_title title_tag=h4]`
|
456 |
-
You will get:
|
457 |
-
`<h4 class="lcp_title">
|
458 |
-
<a title="Hipchat" href="http://127.0.0.1:8080/wordpress/?p=40"></a>
|
459 |
-
</h4>`
|
460 |
|
461 |
== Template System ==
|
462 |
|
463 |
-
|
464 |
-
|
465 |
-
You can use the included template as an example to start. It's in the plugin's template folder under the name default.php. To use a template, use this code:
|
466 |
-
`[catlist id=1 template=templatename]`
|
467 |
-
If the template file were templatename.php.
|
468 |
-
|
469 |
-
You can have as many different templates as you want, and use them in different pages and posts. The template code is pretty well documented, so if you're a bit familiar with HTML and PHP, you'll have no problems creating your own template. I'm planning on reworking the template system in order to have a really user friendly way to create templates.
|
470 |
|
471 |
== Frequently Asked Questions ==
|
472 |
|
@@ -476,13 +395,13 @@ You can find the Frequently Asked Questions [here](https://github.com/picandocod
|
|
476 |
|
477 |
**INSTRUCTIONS ON HOW TO USE THE PLUGIN**
|
478 |
|
479 |
-
|
480 |
|
481 |
Please read the instructions and the FAQ before opening a new topic in the support forums.
|
482 |
|
483 |
**TEMPLATE SYSTEM**
|
484 |
|
485 |
-
How to customize the way the posts are shown:
|
486 |
|
487 |
**NEW FEATURE REQUESTS, BUG FIXES, ENHANCEMENTS**
|
488 |
|
@@ -532,6 +451,12 @@ Template system has changed. Custom templates should be stored in WordPress them
|
|
532 |
|
533 |
== Changelog ==
|
534 |
|
|
|
|
|
|
|
|
|
|
|
|
|
535 |
= 0.69 =
|
536 |
|
537 |
* Update lcp-widget.php for PHP 7 compatibility. Thanks @kenshin23!
|
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: 4.7
|
7 |
+
Stable tag: 0.70
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
24 |
also display the post author, date, excerpt, custom field values, even
|
25 |
the content! A lot of parameters have been added to customize what to
|
26 |
display and how to show it. Check [the full
|
27 |
+
documentation](https://github.com/picandocodigo/List-Category-Posts/wiki)
|
28 |
to learn about the different ways to use it.
|
29 |
|
30 |
The `[catlist]` shortcode can be used as many times as needed with
|
38 |
instance (you can override this value by using the `numberposts`
|
39 |
parameter in your shortcode).
|
40 |
|
41 |
+
**[Read the instructions](https://github.com/picandocodigo/List-Category-Posts/wiki)** to learn which parameters are available and how to use them.
|
42 |
|
43 |
If you want to **List Categories** instead of posts you can use my other plugin **[List categories](http://wordpress.org/plugins/list-categories/)**.
|
44 |
|
46 |
|
47 |
**Customization**
|
48 |
|
49 |
+
The different elements to display can be styled with CSS. you can define an HTML tag to wrap the element with, and a CSS class for this tag. Check [the documentation](https://github.com/picandocodigo/List-Category-Posts/wiki) for usage.
|
50 |
|
51 |
Great to use WordPress as a CMS, and create pages with several categories posts.
|
52 |
|
58 |
functionality in the shortcode has been implemented in the widget
|
59 |
yet. You can use the shortcode for the most flexibility.
|
60 |
|
61 |
+
Please, read the information on [the wiki](https://github.com/picandocodigo/List-Category-Posts/wiki)
|
|
|
62 |
and
|
63 |
[Changelog](http://wordpress.org/extend/plugins/list-category-posts/changelog/)
|
64 |
to be aware of new functionality, and improvements to the plugin.
|
84 |
|
85 |
* Upload the `list-category-posts` directory to your wp-content/plugins/ directory.
|
86 |
* Login to your WordPress Admin menu, go to Plugins, and activate it.
|
87 |
+
* Start using the '[catlist]` shortcode in your posts and/or pages.
|
88 |
* You can find the List Category Posts widget in the Appearence > Widgets section on your WordPress Dashboard.
|
89 |
+
* If you want to customize the way the plugin displays the information, check [HTML & CSS Customization](https://github.com/picandocodigo/List-Category-Posts/wiki/HTML-&-CSS-Customization) or the [section on Templates](https://github.com/picandocodigo/List-Category-Posts/wiki/Template-System) on the wiki.
|
90 |
|
91 |
==Other notes==
|
92 |
|
93 |
+
Since the documentation on how to use the plugin has passed wordpress.org's character limit, the text was cut. I've since started using [a wiki](https://github.com/picandocodigo/List-Category-Posts/wiki) for more comfortable reading and maintaining. Please check it out, suggestions are welcome on GitHub issues!
|
94 |
+
|
95 |
==Instructions on how to use the plugin==
|
96 |
|
97 |
==SELECTING THE CATEGORY==
|
134 |
|
135 |
* **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.
|
136 |
|
137 |
+
* **date ranges** - You can also use date ranges for listing posts. For example "list every post after March 14th, 2005". The parameters are: ```after, after_year, after_month, after_day, before, before_year, before_month, before_day```. These parameters are used to specify data_query arguments (see: [the codex](https://codex.wordpress.org/Class_Reference/WP_Query#Date_Parameters)).
|
138 |
+
|
139 |
+
If you want to list all the posts before a given date, say `Jun 17th, 2007` you can use these two options:
|
140 |
+
`[catlist before_year=2007 before_month=06 before_day=17]`
|
141 |
+
Or you can use the `before` parameter with a [strtotime()-compatible string](http://php.net/manual/en/datetime.formats.date.php):
|
142 |
+
`[catlist before='2007/06/17']`
|
143 |
+
|
144 |
+
The same works for posts after a given date, you can use:
|
145 |
+
`[catlist after_year=2007 after_month=06 after_day=17]`
|
146 |
+
Or just `after` with a [strtotime()-compatible string](http://php.net/manual/en/datetime.formats.date.php):
|
147 |
+
`[catlist after='2007/06/17']`
|
148 |
+
|
149 |
+
`after` takes priority over `after_year`, `after_month`, and `after_day`.
|
150 |
+
`before` takes priority over `before_year`, `before_month`, and `before_day`.
|
151 |
+
|
152 |
* **search** - List posts that match a search term. `[catlist search="The Cake is a lie"]`
|
153 |
|
154 |
* **excludeposts** - IDs of posts to exclude from the list. Use 'this' to exclude the current post. Ex: `[catlist excludeposts=this,12,52,37]`
|
177 |
|
178 |
* **custom fields** - To use custom fields, you must specify two values: customfield_name and customfield_value. Using this only show posts that contain a custom field with this name and value. Both parameters must be defined, or neither will work.
|
179 |
|
180 |
+
==PAGINATION
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
|
182 |
+
https://github.com/picandocodigo/List-Category-Posts/wiki/Pagination
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
|
184 |
==OTHER PARAMETERS==
|
185 |
|
269 |
|
270 |
* **content** - **WARNING**: If you want to show the content on your listed posts, you might want to do this from a new [Page Template](http://codex.wordpress.org/Page_Templates) or a [Custom Post Type](http://codex.wordpress.org/Post_Types#Custom_Post_Type_Templates) template. Using this parameter is discouraged, you can have memory issues as well as infinite loop situations when you're displaying a post that's using List Category Posts. You have been warned. Usage:
|
271 |
|
272 |
+
* `yes` - Show the excerpt or full content of the post. If there's a <!--more--> 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]`
|
273 |
|
274 |
+
* `full` - Show the full content of the post regardless of whether there is a <!--more--> tag in the post. Ex: `[catlist content=full]`
|
275 |
|
276 |
* **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.
|
277 |
|
381 |
|
382 |
== HTML & CSS Customization ==
|
383 |
|
384 |
+
https://github.com/picandocodigo/List-Category-Posts/wiki/HTML-&-CSS-Customization
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
385 |
|
386 |
== Template System ==
|
387 |
|
388 |
+
https://github.com/picandocodigo/List-Category-Posts/wiki/Template-System
|
|
|
|
|
|
|
|
|
|
|
|
|
389 |
|
390 |
== Frequently Asked Questions ==
|
391 |
|
395 |
|
396 |
**INSTRUCTIONS ON HOW TO USE THE PLUGIN**
|
397 |
|
398 |
+
https://github.com/picandocodigo/List-Category-Posts/wiki/
|
399 |
|
400 |
Please read the instructions and the FAQ before opening a new topic in the support forums.
|
401 |
|
402 |
**TEMPLATE SYSTEM**
|
403 |
|
404 |
+
How to customize the way the posts are shown: https://github.com/picandocodigo/List-Category-Posts/wiki/Template-System. I am aware the Template System is not the friendliest right now, I'll work on improving this if I ever get the time to work on it.
|
405 |
|
406 |
**NEW FEATURE REQUESTS, BUG FIXES, ENHANCEMENTS**
|
407 |
|
451 |
|
452 |
== Changelog ==
|
453 |
|
454 |
+
= 0.70 =
|
455 |
+
|
456 |
+
* Fixed [customfield_class and customfield_tag issues](https://github.com/picandocodigo/List-Category-Posts/issues/201). Thanks [vacuus](https://github.com/vacuus)!!
|
457 |
+
* Tested up to WordPress 4.6.1
|
458 |
+
* Added date range, thanks again [vacuus](https://github.com/vacuus)!! Check [the docs](https://github.com/picandocodigo/List-Category-Posts/wiki/How-to-select-which-posts-to-show) to read how to use this.
|
459 |
+
|
460 |
= 0.69 =
|
461 |
|
462 |
* Update lcp-widget.php for PHP 7 compatibility. Thanks @kenshin23!
|