Version Description
- Small fixes. Should work for name parameter in all cases now.
Download this release
Release Info
Developer | fernandobt |
Plugin | List category posts |
Version | 0.18.2 |
Comparing to | |
See all releases |
Code changes from version 0.18.1 to 0.18.2
- include/CatList.php +3 -4
- include/CatListDisplayer.php +3 -4
- list_cat_posts.php +1 -1
- readme.txt +4 -1
- templates/default.php +1 -1
include/CatList.php
CHANGED
@@ -57,13 +57,12 @@ class CatList{
|
|
57 |
*/
|
58 |
private function get_category_id_by_name($cat_name){
|
59 |
//We check if the name gets the category id, if not, we check the slug.
|
60 |
-
$term = get_term_by('
|
61 |
-
|
62 |
if (!$term):
|
63 |
$term = get_term_by('name', $cat_name, 'category');
|
64 |
endif;
|
65 |
|
66 |
-
return $term->term_id;
|
67 |
}
|
68 |
|
69 |
public function get_category_id(){
|
@@ -78,7 +77,7 @@ class CatList{
|
|
78 |
* Load category name and link to the category:
|
79 |
*/
|
80 |
public function get_category_link(){
|
81 |
-
if($this->params['
|
82 |
$cat_link = get_category_link($this->lcp_category_id);
|
83 |
$cat_title = get_cat_name($this->lcp_category_id);
|
84 |
return '<a href="' . $cat_link . '" title="' . $cat_title . '">' . $cat_title . '</a>';
|
57 |
*/
|
58 |
private function get_category_id_by_name($cat_name){
|
59 |
//We check if the name gets the category id, if not, we check the slug.
|
60 |
+
$term = get_term_by('slug', $cat_name, 'category');
|
|
|
61 |
if (!$term):
|
62 |
$term = get_term_by('name', $cat_name, 'category');
|
63 |
endif;
|
64 |
|
65 |
+
return ($term) ? $term->term_id : 0;
|
66 |
}
|
67 |
|
68 |
public function get_category_id(){
|
77 |
* Load category name and link to the category:
|
78 |
*/
|
79 |
public function get_category_link(){
|
80 |
+
if($this->params['catlink'] == 'yes' && $this->lcp_category_id != 0){
|
81 |
$cat_link = get_category_link($this->lcp_category_id);
|
82 |
$cat_title = get_cat_name($this->lcp_category_id);
|
83 |
return '<a href="' . $cat_link . '" title="' . $cat_title . '">' . $cat_title . '</a>';
|
include/CatListDisplayer.php
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* This is an auxiliary class to help display the info on your CatList.php instance.
|
4 |
-
*
|
5 |
* @author fernando@picandocodigo.nets
|
6 |
*/
|
7 |
require_once 'CatList.php';
|
@@ -55,7 +54,7 @@ class CatListDisplayer {
|
|
55 |
}
|
56 |
|
57 |
private function build_output($tag){
|
58 |
-
$this->lcp_output .= $this->get_category_link(
|
59 |
$this->lcp_output .= '<' . $tag . ' class="'.$this->params['class'].'">';
|
60 |
$inner_tag = ($tag == 'ul') ? 'li' : 'p';
|
61 |
//Posts loop
|
@@ -102,7 +101,7 @@ class CatListDisplayer {
|
|
102 |
return $this->assign_style($info, $tag, $css_class);
|
103 |
}
|
104 |
|
105 |
-
private function get_comments($single, $tag = null, $
|
106 |
$info = $this->catlist->get_comments_count($single);
|
107 |
return $this->assign_style($info, $tag, $css_class);
|
108 |
}
|
@@ -136,7 +135,7 @@ class CatListDisplayer {
|
|
136 |
return '<a href="' . get_permalink($single->ID).'">' . $single->post_title . '</a>';
|
137 |
}
|
138 |
|
139 |
-
private function get_category_link($
|
140 |
$info = $this->catlist->get_category_link();
|
141 |
return $this->assign_style($info, $tag, $css_class);
|
142 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
* This is an auxiliary class to help display the info on your CatList.php instance.
|
|
|
4 |
* @author fernando@picandocodigo.nets
|
5 |
*/
|
6 |
require_once 'CatList.php';
|
54 |
}
|
55 |
|
56 |
private function build_output($tag){
|
57 |
+
$this->lcp_output .= $this->get_category_link('strong');
|
58 |
$this->lcp_output .= '<' . $tag . ' class="'.$this->params['class'].'">';
|
59 |
$inner_tag = ($tag == 'ul') ? 'li' : 'p';
|
60 |
//Posts loop
|
101 |
return $this->assign_style($info, $tag, $css_class);
|
102 |
}
|
103 |
|
104 |
+
private function get_comments($single, $tag = null, $css_class = null){
|
105 |
$info = $this->catlist->get_comments_count($single);
|
106 |
return $this->assign_style($info, $tag, $css_class);
|
107 |
}
|
135 |
return '<a href="' . get_permalink($single->ID).'">' . $single->post_title . '</a>';
|
136 |
}
|
137 |
|
138 |
+
private function get_category_link($tag = null, $css_class = null){
|
139 |
$info = $this->catlist->get_category_link();
|
140 |
return $this->assign_style($info, $tag, $css_class);
|
141 |
}
|
list_cat_posts.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: List category posts
|
4 |
Plugin URI: http://picandocodigo.net/programacion/wordpress/list-category-posts-wordpress-plugin-english/
|
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.18.
|
7 |
Author: Fernando Briano
|
8 |
Author URI: http://picandocodigo.net/
|
9 |
*/
|
3 |
Plugin Name: List category posts
|
4 |
Plugin URI: http://picandocodigo.net/programacion/wordpress/list-category-posts-wordpress-plugin-english/
|
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.18.2
|
7 |
Author: Fernando Briano
|
8 |
Author URI: http://picandocodigo.net/
|
9 |
*/
|
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: 2.8
|
6 |
Tested up to: 3.1
|
7 |
-
Stable tag: 0.18.
|
8 |
|
9 |
== Description ==
|
10 |
List Category Posts is a simple WordPress plugin which 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.
|
@@ -137,6 +137,9 @@ Template system has changed. Custom templates should be stored in WordPress them
|
|
137 |
|
138 |
== Changelog ==
|
139 |
|
|
|
|
|
|
|
140 |
= 0.18.1 =
|
141 |
* Added slug and name to the fetching of category id from previous update.
|
142 |
|
4 |
Tags: list, categories, posts, cms
|
5 |
Requires at least: 2.8
|
6 |
Tested up to: 3.1
|
7 |
+
Stable tag: 0.18.2
|
8 |
|
9 |
== Description ==
|
10 |
List Category Posts is a simple WordPress plugin which 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.
|
137 |
|
138 |
== Changelog ==
|
139 |
|
140 |
+
= 0.18.2 =
|
141 |
+
* Small fixes. Should work for name parameter in all cases now.
|
142 |
+
|
143 |
= 0.18.1 =
|
144 |
* Added slug and name to the fetching of category id from previous update.
|
145 |
|
templates/default.php
CHANGED
@@ -35,7 +35,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
35 |
$lcp_display_output = '';
|
36 |
|
37 |
// Show category link:
|
38 |
-
$lcp_display_output .= $this->get_category_link(
|
39 |
|
40 |
//Add 'starting' tag. Here, I'm using an unordered list (ul) as an example:
|
41 |
$lcp_output .= '<ul class="lcp_catlist">';
|
35 |
$lcp_display_output = '';
|
36 |
|
37 |
// Show category link:
|
38 |
+
$lcp_display_output .= $this->get_category_link('strong');
|
39 |
|
40 |
//Add 'starting' tag. Here, I'm using an unordered list (ul) as an example:
|
41 |
$lcp_output .= '<ul class="lcp_catlist">';
|