Permalink
Browse files

Adds posts_morelink param, add a 'read more' link to each post

  • Loading branch information...
picandocodigo committed Jan 22, 2013
1 parent e9b40ad commit acf3405d4845a9c9c2148eda44faad768ad61c4e
Showing with 21 additions and 4 deletions.
  1. +10 −1 include/CatListDisplayer.php
  2. +3 −1 list_cat_posts.php
  3. +8 −2 readme.txt
@@ -185,8 +185,17 @@ private function lcp_build_post($single, $tag){
$lcp_display_output .= $this->get_excerpt($single);
endif;
- $lcp_display_output .= '</' . $tag . '>';
+ if (!empty($this->params['posts_morelink'])) :
+ $href = 'href="'.get_permalink($single->ID) . '"';
+ $class = "";
+ if (!empty($this->params['posts_morelink_class'])) :
+ $class = 'class="' . $this->params['posts_morelink_class'] . '" ';
+ endif;
+ $readmore = $this->params['posts_morelink'];
+ $lcp_display_output .= ' <a ' . $href . ' ' . $class . ' >' . $readmore . '</a>';
+ endif;
+ $lcp_display_output .= '</' . $tag . '>';
return $lcp_display_output;
}
View
@@ -3,7 +3,7 @@
Plugin Name: List category posts
Plugin URI: https://github.com/picandocodigo/List-Category-Posts
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].
- Version: 0.27.1
+ Version: 0.28
Author: Fernando Briano
Author URI: http://picandocodigo.net/
@@ -88,6 +88,8 @@ function catlist_func($atts, $content = null) {
'categorypage' => '',
'morelink' => '',
'morelink_class' => '',
+ 'posts_morelink' => '',
+ 'posts_morelink_class' => '',
'year' => '',
'monthnum' => '',
'search' => ''
View
@@ -4,7 +4,7 @@ Donate Link: http://picandocodigo.net/programacion/wordpress/list-category-posts
Tags: list, categories, posts, cms
Requires at least: 3.3
Tested up to: 3.5
-Stable tag: 0.27.1
+Stable tag: 0.28
== Description ==
List Category Posts allows you to list posts from a category into a post/page using the [catlist] shortcode.
@@ -145,13 +145,15 @@ You can use the *categorypage* parameter to make it detect the category id of th
* **morelink** - Include a "more" link to access the category archive for the category. The link is inserted after listing the posts. It receives a string of characters as a parameter which will be used as the text of the link. Example: [catlist id=38 morelink="Read more"]
+* **posts_morelink** - Include a "read more" link after each post. It receives a string of characters as a parameter which will be used as the text of the link. Example: [catlist id=38 posts_morelink="Read more about this post"]
+
== HTML & CSS Customization ==
You can customize what HTML tags different elements will be sorrounded with and a CSS class for this element. The customizable elements are: author, catlink (category link), comments, date, excerpt, morelink ("Read More" link), thumbnail and title (post title).
The parameters are:
`autor_tag, author_class, catlink_tag, catlink_class, comments_tag, comments_class, date_tag, date_class,
-excerpt_tag, excerpt_class, morelink_class, thumbnail_class, title_tag, title_class`
+excerpt_tag, excerpt_class, morelink_class, thumbnail_class, title_tag, title_class, posts_morelink_class`
So for example, let's say you want to wrap the displayed comments count with the p tag and a "lcp_comments" class, you would do:
`[catlist id=7 comments=yes comments_tag=p comments_class=lcp_comments]`
@@ -232,6 +234,10 @@ Template system has changed. Custom templates should be stored in WordPress them
== Changelog ==
+= 0.28 =
+ * Improvements on readme, faqs.
+ * New posts_morelink param: adds a 'read more' link to each post.
+
= 0.27.1 =
* Sets minimum version to WordPress 3.3, since wp_trim_words was introduced in that version. Adds workaround for people using WordPress < 3.3.

0 comments on commit acf3405

Please sign in to comment.