Version Description
- Use post title as alt attribute in thumbnails. Thanks @arcticmouse!
- Dynamic pagination paddin. Thanks @zymeth25! More info: https://github.com/picandocodigo/List-Category-Posts/wiki/Pagination#pagination-padding
- Bugfix current category for posts displayed in the loop. Thanks @zymeth25! More info: https://github.com/picandocodigo/List-Category-Posts/pull/363
- Added "private" text next to a post's title when it's private, thanks to a suggestion by @cmccrone in the support forums. The text is published with the following html:
<span class="lcp_private"> private</span>
, so you can customize the CSS (hide it, change its color, etc.).
Download this release
Release Info
Developer | fernandobt |
Plugin | List category posts |
Version | 0.80 |
Comparing to | |
See all releases |
Code changes from version 0.79 to 0.80
- include/lcp-category.php +7 -3
- include/lcp-catlist.php +2 -1
- include/lcp-catlistdisplayer.php +3 -0
- include/lcp-paginator.php +68 -29
- include/lcp-post-builder.php +0 -126
- include/lcp-thumbnail.php +10 -6
- list-category-posts.php +2 -1
- readme.txt +29 -3
include/lcp-category.php
CHANGED
@@ -65,9 +65,13 @@ class LcpCategory{
|
|
65 |
$category = get_category( get_query_var( 'cat' ) );
|
66 |
if( isset( $category->errors ) && $category->errors["invalid_term"][0] == __("Empty Term.") ){
|
67 |
global $post;
|
68 |
-
|
69 |
-
|
70 |
-
|
|
|
|
|
|
|
|
|
71 |
$categories = get_the_category($post->ID);
|
72 |
}
|
73 |
if ( !empty($categories) ){
|
65 |
$category = get_category( get_query_var( 'cat' ) );
|
66 |
if( isset( $category->errors ) && $category->errors["invalid_term"][0] == __("Empty Term.") ){
|
67 |
global $post;
|
68 |
+
/* Since WP 4.9 global $post is nullified in text widgets
|
69 |
+
* when is_singular() is false.
|
70 |
+
*
|
71 |
+
* Added in_the_loop check to make the shortcode work
|
72 |
+
* in posts listed in archives and home page (#358).
|
73 |
+
*/
|
74 |
+
if ( is_singular() || in_the_loop() ) {
|
75 |
$categories = get_the_category($post->ID);
|
76 |
}
|
77 |
if ( !empty($categories) ){
|
include/lcp-catlist.php
CHANGED
@@ -430,14 +430,15 @@ class CatList{
|
|
430 |
|
431 |
public function get_pagination(){
|
432 |
$paginator_params = array(
|
|
|
433 |
'instance' => $this->get_instance(),
|
434 |
'next' => $this->params['pagination_next'],
|
435 |
'numberposts' => $this->get_number_posts(),
|
|
|
436 |
'page' => $this->get_page(),
|
437 |
'pagination' => $this->params['pagination'],
|
438 |
'posts_count' => $this->get_posts_count(),
|
439 |
'previous' => $this->params['pagination_prev'],
|
440 |
-
'bookmarks' => $this->params['pagination_bookmarks']
|
441 |
);
|
442 |
return LcpPaginator::get_instance()->get_pagination($paginator_params);
|
443 |
}
|
430 |
|
431 |
public function get_pagination(){
|
432 |
$paginator_params = array(
|
433 |
+
'bookmarks' => $this->params['pagination_bookmarks'],
|
434 |
'instance' => $this->get_instance(),
|
435 |
'next' => $this->params['pagination_next'],
|
436 |
'numberposts' => $this->get_number_posts(),
|
437 |
+
'padding' => $this->params['pagination_padding'],
|
438 |
'page' => $this->get_page(),
|
439 |
'pagination' => $this->params['pagination'],
|
440 |
'posts_count' => $this->get_posts_count(),
|
441 |
'previous' => $this->params['pagination_prev'],
|
|
|
442 |
);
|
443 |
return LcpPaginator::get_instance()->get_pagination($paginator_params);
|
444 |
}
|
include/lcp-catlistdisplayer.php
CHANGED
@@ -404,6 +404,9 @@ class CatListDisplayer {
|
|
404 |
endif;
|
405 |
|
406 |
$info .= '>' . $text . '</a>';
|
|
|
|
|
|
|
407 |
|
408 |
return $info;
|
409 |
}
|
404 |
endif;
|
405 |
|
406 |
$info .= '>' . $text . '</a>';
|
407 |
+
if($single->post_status == 'private'):
|
408 |
+
$info .= '<span class="lcp_private"> private</span>';
|
409 |
+
endif;
|
410 |
|
411 |
return $info;
|
412 |
}
|
include/lcp-paginator.php
CHANGED
@@ -28,38 +28,77 @@ class LcpPaginator {
|
|
28 |
if (LcpUtils::lcp_show_pagination($params['pagination'])){
|
29 |
$lcp_paginator = '';
|
30 |
$pages_count = ceil (
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
);
|
35 |
$pag_output = '';
|
36 |
$this->prev_page_num = null;
|
37 |
$this->next_page_num = null;
|
38 |
-
if ($pages_count > 1){
|
39 |
-
|
40 |
-
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
}
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
}
|
64 |
return $pag_output;
|
65 |
}
|
@@ -95,9 +134,9 @@ class LcpPaginator {
|
|
95 |
|
96 |
$link .= "<li><a href='$page_link' title='$page'";
|
97 |
if ($page === $this->prev_page_num) {
|
98 |
-
|
99 |
} elseif ($page === $this->next_page_num) {
|
100 |
-
|
101 |
}
|
102 |
$link .= ">";
|
103 |
($char != null) ? ($link .= $char) : ($link .= $page);
|
28 |
if (LcpUtils::lcp_show_pagination($params['pagination'])){
|
29 |
$lcp_paginator = '';
|
30 |
$pages_count = ceil (
|
31 |
+
$params['posts_count'] /
|
32 |
+
# Avoid dividing by 0 (pointed out by @rhj4)
|
33 |
+
max( array( 1, $params['numberposts'] ) )
|
34 |
);
|
35 |
$pag_output = '';
|
36 |
$this->prev_page_num = null;
|
37 |
$this->next_page_num = null;
|
38 |
+
if ( $pages_count > 1 ) {
|
39 |
+
/* Dynamic pagination inspired by
|
40 |
+
* https://gist.github.com/shlomohass/9869e138a4fba0e7dc4c
|
41 |
+
*/
|
42 |
+
// Print first page.
|
43 |
+
$lcp_paginator .= $this->lcp_page_link(
|
44 |
+
1,
|
45 |
+
$params['page'],
|
46 |
+
$params['instance'],
|
47 |
+
$params['bookmarks']
|
48 |
+
);
|
49 |
+
// Padding around current page. How many pages will be printed
|
50 |
+
// before and after current page.
|
51 |
+
$pad = intval( $params['padding'] );
|
52 |
+
// Print opening ellipsis if needed
|
53 |
+
$params['page'] - $pad > 2 && $lcp_paginator .= '...';
|
54 |
+
// Loop over pages excluding first and last page.
|
55 |
+
for( $i = 2; $i < $pages_count; $i++ ) {
|
56 |
+
if ( $i >= $params['page'] - $pad && $i <= $params['page'] + $pad ) {
|
57 |
+
$lcp_paginator .= $this->lcp_page_link(
|
58 |
+
$i,
|
59 |
+
$params['page'],
|
60 |
+
$params['instance'],
|
61 |
+
$params['bookmarks']
|
62 |
+
);
|
63 |
}
|
64 |
+
}
|
65 |
+
// Print closing ellipsis if needed
|
66 |
+
$params['page'] + $pad < $pages_count - 1 && $lcp_paginator .= '...';
|
67 |
+
// Print last page.
|
68 |
+
$lcp_paginator .= $this->lcp_page_link(
|
69 |
+
$pages_count,
|
70 |
+
$params['page'],
|
71 |
+
$params['instance'],
|
72 |
+
$params['bookmarks']
|
73 |
+
);
|
74 |
+
|
75 |
+
$pag_output .= "<ul class='lcp_paginator'>";
|
76 |
+
|
77 |
+
// Add "Previous" link
|
78 |
+
if ($params['page'] > 1){
|
79 |
+
$this->prev_page_num = intval(intval($params['page']) - 1);
|
80 |
+
$pag_output .= $this->lcp_page_link(
|
81 |
+
$this->prev_page_num,
|
82 |
+
$params['page'],
|
83 |
+
$params['instance'],
|
84 |
+
$params['bookmarks'], $params['previous']
|
85 |
+
);
|
86 |
+
}
|
87 |
+
|
88 |
+
$pag_output .= $lcp_paginator;
|
89 |
+
|
90 |
+
// Add "Next" link
|
91 |
+
if ($params['page'] < $pages_count){
|
92 |
+
$this->next_page_num = intval($params['page'] + 1);
|
93 |
+
$pag_output .= $this->lcp_page_link(
|
94 |
+
$this->next_page_num,
|
95 |
+
$params['page'],
|
96 |
+
$params['instance'],
|
97 |
+
$params['bookmarks'], $params['next']
|
98 |
+
);
|
99 |
+
}
|
100 |
+
|
101 |
+
$pag_output .= "</ul>";
|
102 |
}
|
103 |
return $pag_output;
|
104 |
}
|
134 |
|
135 |
$link .= "<li><a href='$page_link' title='$page'";
|
136 |
if ($page === $this->prev_page_num) {
|
137 |
+
$link .= " class='lcp_prevlink'";
|
138 |
} elseif ($page === $this->next_page_num) {
|
139 |
+
$link .= " class='lcp_nextlink'";
|
140 |
}
|
141 |
$link .= ">";
|
142 |
($char != null) ? ($link .= $char) : ($link .= $page);
|
include/lcp-post-builder.php
DELETED
@@ -1,126 +0,0 @@
|
|
1 |
-
<?
|
2 |
-
|
3 |
-
class LcpPostBuilder{
|
4 |
-
// Singleton implementation
|
5 |
-
private static $instance = null;
|
6 |
-
|
7 |
-
public static function get_instance(){
|
8 |
-
if( !isset( self::$instance ) ){
|
9 |
-
self::$instance = new self;
|
10 |
-
}
|
11 |
-
return self::$instance;
|
12 |
-
}
|
13 |
-
|
14 |
-
/**
|
15 |
-
* This function should be overriden for template system.
|
16 |
-
* @param post $single
|
17 |
-
* @param HTML tag to display $tag
|
18 |
-
* @return string
|
19 |
-
*/
|
20 |
-
public function lcp_build_post($single, $tag){
|
21 |
-
global $post;
|
22 |
-
|
23 |
-
$class ='';
|
24 |
-
if ( $post->ID == $single->ID ):
|
25 |
-
$class = " class = current ";
|
26 |
-
endif;
|
27 |
-
|
28 |
-
$lcp_display_output = '<'. $tag . $class . '>';
|
29 |
-
|
30 |
-
$lcp_display_output .= $this->get_post_title($single);
|
31 |
-
|
32 |
-
// Comments count
|
33 |
-
$lcp_display_output .= $this->get_comments($single, $this->params['comments_tag'], $this->params['comments_class']);
|
34 |
-
|
35 |
-
// Date
|
36 |
-
$lcp_display_output .= $this->get_date($single,
|
37 |
-
$this->params['date_tag'],
|
38 |
-
$this->params['date_class']);
|
39 |
-
|
40 |
-
// Date Modified
|
41 |
-
if (!empty($this->params['date_modified_tag']) || !empty($this->params['date_modified_class'])):
|
42 |
-
$lcp_display_output .= $this->get_modified_date($single,
|
43 |
-
$this->params['date_modified_tag'],
|
44 |
-
$this->params['date_modified_class']);
|
45 |
-
else:
|
46 |
-
$lcp_display_output .= $this->get_modified_date($single);
|
47 |
-
endif;
|
48 |
-
|
49 |
-
// Author
|
50 |
-
$lcp_display_output .= $this->get_author($single,
|
51 |
-
$this->params['author_tag'],
|
52 |
-
$this->params['author_class']);
|
53 |
-
|
54 |
-
// Display ID
|
55 |
-
if (!empty($this->params['display_id']) && $this->params['display_id'] == 'yes'){
|
56 |
-
$lcp_display_output .= $single->ID;
|
57 |
-
}
|
58 |
-
|
59 |
-
// Custom field display
|
60 |
-
$lcp_display_output .= $this->get_custom_fields($single);
|
61 |
-
|
62 |
-
$lcp_display_output .= $this->get_thumbnail($single);
|
63 |
-
|
64 |
-
// Content
|
65 |
-
$lcp_display_output .= $this->get_content($single,
|
66 |
-
$this->params['content_tag'],
|
67 |
-
$this->params['content_class']);
|
68 |
-
|
69 |
-
// Excerpt
|
70 |
-
$lcp_display_output .= $this->get_excerpt($single,
|
71 |
-
$this->params['excerpt_tag'],
|
72 |
-
$this->params['excerpt_class']);
|
73 |
-
|
74 |
-
$lcp_display_output .= $this->get_posts_morelink($single);
|
75 |
-
|
76 |
-
$lcp_display_output .= '</' . $tag . '>';
|
77 |
-
return $lcp_display_output;
|
78 |
-
}
|
79 |
-
|
80 |
-
private function get_post_title($single, $tag = null, $css_class = null){
|
81 |
-
$info = '<a href="' . get_permalink($single->ID);
|
82 |
-
|
83 |
-
$lcp_post_title = apply_filters('the_title', $single->post_title, $single->ID);
|
84 |
-
|
85 |
-
if ( !empty($this->params['title_limit']) && $this->params['title_limit'] != "0" ):
|
86 |
-
$lcp_post_title = substr($lcp_post_title, 0, intval($this->params['title_limit']));
|
87 |
-
if( strlen($lcp_post_title) >= intval($this->params['title_limit']) ):
|
88 |
-
$lcp_post_title .= "…";
|
89 |
-
endif;
|
90 |
-
endif;
|
91 |
-
|
92 |
-
$info.= '" title="' . wptexturize($single->post_title) . '"';
|
93 |
-
|
94 |
-
if (!empty($this->params['link_target'])):
|
95 |
-
$info .= ' target="' . $this->params['link_target'] . '" ';
|
96 |
-
endif;
|
97 |
-
|
98 |
-
if ( !empty($this->params['title_class'] ) &&
|
99 |
-
empty($this->params['title_tag']) ):
|
100 |
-
$info .= ' class="' . $this->params['title_class'] . '"';
|
101 |
-
endif;
|
102 |
-
|
103 |
-
$info .= '>' . $lcp_post_title . '</a>';
|
104 |
-
|
105 |
-
if( !empty($this->params['post_suffix']) ):
|
106 |
-
$info .= " " . $this->params['post_suffix'];
|
107 |
-
endif;
|
108 |
-
|
109 |
-
if (!empty($this->params['title_tag'])){
|
110 |
-
$pre = "<" . $this->params['title_tag'];
|
111 |
-
if (!empty($this->params['title_class'])){
|
112 |
-
$pre .= ' class="' . $this->params['title_class'] . '"';
|
113 |
-
}
|
114 |
-
$pre .= '>';
|
115 |
-
$post = "</" . $this->params['title_tag'] . ">";
|
116 |
-
$info = $pre . $info . $post;
|
117 |
-
}
|
118 |
-
|
119 |
-
if( $tag !== null || $css_class !== null){
|
120 |
-
$info = $this->assign_style($info, $tag, $css_class);
|
121 |
-
}
|
122 |
-
|
123 |
-
return $info;
|
124 |
-
}
|
125 |
-
|
126 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
include/lcp-thumbnail.php
CHANGED
@@ -41,11 +41,15 @@ class LcpThumbnail{
|
|
41 |
$lcp_thumbnail = '<a href="' . esc_url(get_permalink($single->ID)) .
|
42 |
'" title="' . esc_attr($single->post_title) . '">';
|
43 |
|
44 |
-
$lcp_thumbnail
|
45 |
-
|
46 |
-
$
|
47 |
-
|
48 |
-
|
|
|
|
|
|
|
|
|
49 |
$lcp_thumbnail .= '</a>';
|
50 |
} else {
|
51 |
// if thumbnail is requested but not found as featured image, grab first image in the content of the post
|
@@ -98,4 +102,4 @@ class LcpThumbnail{
|
|
98 |
$lcp_thumbnail .= '<a href="' . get_permalink($single->ID).'">' . $lcp_ytimage . '</a>';
|
99 |
}
|
100 |
}
|
101 |
-
}
|
41 |
$lcp_thumbnail = '<a href="' . esc_url(get_permalink($single->ID)) .
|
42 |
'" title="' . esc_attr($single->post_title) . '">';
|
43 |
|
44 |
+
$lcp_thumbnail = '<img src="' . get_the_post_thumbnail_url($single->ID, $lcp_thumb_size) .'"';
|
45 |
+
if ( $lcp_thumb_class != null ) { // thumbnail class passed as parameter to shortcode
|
46 |
+
$lcp_thumbnail .= ' class="' . $lcp_thumb_class . '" ';
|
47 |
+
}
|
48 |
+
else { // Otherwise, use this class name
|
49 |
+
$lcp_thumbnail .= ' class="lcp_thumbnail" ';
|
50 |
+
}
|
51 |
+
$lcp_thumbnail .= ' alt="' . esc_attr($single->post_title) . '" />';
|
52 |
+
|
53 |
$lcp_thumbnail .= '</a>';
|
54 |
} else {
|
55 |
// if thumbnail is requested but not found as featured image, grab first image in the content of the post
|
102 |
$lcp_thumbnail .= '<a href="' . get_permalink($single->ID).'">' . $lcp_ytimage . '</a>';
|
103 |
}
|
104 |
}
|
105 |
+
}
|
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 |
|
@@ -126,6 +126,7 @@ class ListCategoryPosts{
|
|
126 |
'pagination' => '',
|
127 |
'pagination_next' => '>>',
|
128 |
'pagination_prev' => '<<',
|
|
|
129 |
'no_posts_text' => "",
|
130 |
'instance' => '0',
|
131 |
'no_post_titles' => 'no',
|
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.80
|
7 |
Author: Fernando Briano
|
8 |
Author URI: http://fernandobriano.com
|
9 |
|
126 |
'pagination' => '',
|
127 |
'pagination_next' => '>>',
|
128 |
'pagination_prev' => '<<',
|
129 |
+
'pagination_padding' => '5',
|
130 |
'no_posts_text' => "",
|
131 |
'instance' => '0',
|
132 |
'no_post_titles' => 'no',
|
readme.txt
CHANGED
@@ -3,9 +3,9 @@ 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: 5.
|
7 |
Requires PHP: 5.4
|
8 |
-
Stable tag: 0.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -79,52 +79,71 @@ Read the **[full documentation](https://github.com/picandocodigo/List-Category-P
|
|
79 |
* **custom templates** of your own design, based on a simple PHP example
|
80 |
|
81 |
List 10 latest posts:
|
|
|
82 |
`[catlist]`
|
83 |
|
84 |
The default number of listed posts is 10, to modify it you need to specify `numberposts` parameter:
|
|
|
85 |
`[catlist numberposts=15]`
|
86 |
|
87 |
List posts from the "Dogs" category:
|
|
|
88 |
`[catlist name=Dogs]`
|
89 |
|
90 |
List posts from the category with id `2`:
|
|
|
91 |
`[catlist id=2]`
|
92 |
|
93 |
By default only the "post" post type is included. To list pages use:
|
|
|
94 |
`[catlist post_type=page]`
|
|
|
95 |
and for both posts and pages:
|
|
|
96 |
`[catlist post_type="post,page"]`
|
97 |
|
98 |
If we combine the above options we can get a shortcode that lists 15 items, including post and pages, from the "Dogs" category:
|
|
|
99 |
`[catlist name=Dogs post_type="post,page" numberposts=15]`
|
|
|
100 |
Most of the parameters you will find in the documentation can be used together.
|
101 |
|
102 |
The plugin can detect current post's category and use it for listing:
|
|
|
103 |
`[catlist categorypage=yes]`
|
|
|
104 |
Same goes for tags:
|
|
|
105 |
`[catlist currenttags=yes]`
|
106 |
|
107 |
To show each post's excerpt use:
|
|
|
108 |
`[catlist excerpt=yes]`
|
109 |
|
110 |
If you want to show the date, author and comments count next to each post, use:
|
|
|
111 |
`[catlist date=yes author=yes comments=yes]`
|
112 |
|
113 |
You can specify html tags and classes for many elements. Let's modify the previous shortcode and wrap dates and authors in tags and classes of our choice:
|
|
|
114 |
`[catlist date=yes date_tag=span date_class="my-date" author=yes author_tag=p author_class="my-author" comments=yes]`
|
|
|
115 |
[Read more about this feature](https://github.com/picandocodigo/List-Category-Posts/wiki/HTML-&-CSS-Customization)
|
116 |
|
117 |
You can order posts by date:
|
|
|
118 |
`[catlist orderby=date]`
|
|
|
119 |
You can also use `title`, `author`, `ID`. More options are described in the documentation.
|
120 |
|
121 |
The plugin also supports pagination. You need to specify `numberposts` to tell the plugin how many posts per page you want:
|
|
|
122 |
`[catlist pagination=yes numberposts=5]`
|
|
|
123 |
See the wiki: [Pagination](https://github.com/picandocodigo/List-Category-Posts/wiki/Pagination) for more information.
|
124 |
|
125 |
Please read the **[full documentation](https://github.com/picandocodigo/List-Category-Posts/wiki)** for detailed documentation of all plugin features, use cases and shortcode parameters.
|
126 |
|
127 |
-
|
128 |
==Installation==
|
129 |
|
130 |
* Upload the `list-category-posts` directory to your wp-content/plugins/ directory.
|
@@ -210,6 +229,13 @@ Template system has changed. Custom templates should be stored in WordPress them
|
|
210 |
|
211 |
== Changelog ==
|
212 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
= 0.79 =
|
214 |
|
215 |
* Requires PHP >= 5.4
|
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: 5.2
|
7 |
Requires PHP: 5.4
|
8 |
+
Stable tag: 0.80
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
79 |
* **custom templates** of your own design, based on a simple PHP example
|
80 |
|
81 |
List 10 latest posts:
|
82 |
+
|
83 |
`[catlist]`
|
84 |
|
85 |
The default number of listed posts is 10, to modify it you need to specify `numberposts` parameter:
|
86 |
+
|
87 |
`[catlist numberposts=15]`
|
88 |
|
89 |
List posts from the "Dogs" category:
|
90 |
+
|
91 |
`[catlist name=Dogs]`
|
92 |
|
93 |
List posts from the category with id `2`:
|
94 |
+
|
95 |
`[catlist id=2]`
|
96 |
|
97 |
By default only the "post" post type is included. To list pages use:
|
98 |
+
|
99 |
`[catlist post_type=page]`
|
100 |
+
|
101 |
and for both posts and pages:
|
102 |
+
|
103 |
`[catlist post_type="post,page"]`
|
104 |
|
105 |
If we combine the above options we can get a shortcode that lists 15 items, including post and pages, from the "Dogs" category:
|
106 |
+
|
107 |
`[catlist name=Dogs post_type="post,page" numberposts=15]`
|
108 |
+
|
109 |
Most of the parameters you will find in the documentation can be used together.
|
110 |
|
111 |
The plugin can detect current post's category and use it for listing:
|
112 |
+
|
113 |
`[catlist categorypage=yes]`
|
114 |
+
|
115 |
Same goes for tags:
|
116 |
+
|
117 |
`[catlist currenttags=yes]`
|
118 |
|
119 |
To show each post's excerpt use:
|
120 |
+
|
121 |
`[catlist excerpt=yes]`
|
122 |
|
123 |
If you want to show the date, author and comments count next to each post, use:
|
124 |
+
|
125 |
`[catlist date=yes author=yes comments=yes]`
|
126 |
|
127 |
You can specify html tags and classes for many elements. Let's modify the previous shortcode and wrap dates and authors in tags and classes of our choice:
|
128 |
+
|
129 |
`[catlist date=yes date_tag=span date_class="my-date" author=yes author_tag=p author_class="my-author" comments=yes]`
|
130 |
+
|
131 |
[Read more about this feature](https://github.com/picandocodigo/List-Category-Posts/wiki/HTML-&-CSS-Customization)
|
132 |
|
133 |
You can order posts by date:
|
134 |
+
|
135 |
`[catlist orderby=date]`
|
136 |
+
|
137 |
You can also use `title`, `author`, `ID`. More options are described in the documentation.
|
138 |
|
139 |
The plugin also supports pagination. You need to specify `numberposts` to tell the plugin how many posts per page you want:
|
140 |
+
|
141 |
`[catlist pagination=yes numberposts=5]`
|
142 |
+
|
143 |
See the wiki: [Pagination](https://github.com/picandocodigo/List-Category-Posts/wiki/Pagination) for more information.
|
144 |
|
145 |
Please read the **[full documentation](https://github.com/picandocodigo/List-Category-Posts/wiki)** for detailed documentation of all plugin features, use cases and shortcode parameters.
|
146 |
|
|
|
147 |
==Installation==
|
148 |
|
149 |
* Upload the `list-category-posts` directory to your wp-content/plugins/ directory.
|
229 |
|
230 |
== Changelog ==
|
231 |
|
232 |
+
= 0.80 =
|
233 |
+
|
234 |
+
* Use post title as alt attribute in thumbnails. Thanks @arcticmouse!
|
235 |
+
* Dynamic pagination paddin. Thanks @zymeth25! More info: https://github.com/picandocodigo/List-Category-Posts/wiki/Pagination#pagination-padding
|
236 |
+
* Bugfix current category for posts displayed in the loop. Thanks @zymeth25! More info: https://github.com/picandocodigo/List-Category-Posts/pull/363
|
237 |
+
* Added "private" text next to a post's title when it's private, thanks to a suggestion by @cmccrone in the support forums. The text is published with the following html: `<span class="lcp_private"> private</span>`, so you can customize the CSS (hide it, change its color, etc.).
|
238 |
+
|
239 |
= 0.79 =
|
240 |
|
241 |
* Requires PHP >= 5.4
|