Version Description
- Fixes bug with thumbnail size on Widget.
- Adds feature to make widget title a link to the category. Use 'catlink' as the value for the widget's title to make it a link to the category (based on https://github.com/picandocodigo/List-Category-Posts/pull/51/).
- Fixes morelink styiling with CSS class and tag.
- Adds morelink to templates (based on https://github.com/picandocodigo/List-Category-Posts/pull/48/)
- Fixes tag and CSS class for "catlink" too: http://wordpress.org/support/topic/cat_link-tag-does-not-seem-to-be-working
Download this release
Release Info
Developer | fernandobt |
Plugin | List category posts |
Version | 0.33 |
Comparing to | |
See all releases |
Code changes from version 0.32 to 0.33
- include/CatList.php +33 -18
- include/CatListDisplayer.php +29 -8
- include/ListCategoryPostsWidget.php +9 -3
- include/lcp_widget_form.php +2 -1
- list_cat_posts.php +2 -1
- readme.txt +8 -1
- templates/default.php +4 -0
include/CatList.php
CHANGED
@@ -211,14 +211,29 @@ class CatList{
|
|
211 |
$cat_title = get_cat_name($this->lcp_category_id);
|
212 |
|
213 |
return '<a href="' . $cat_link . '" title="' . $cat_title . '">' .
|
214 |
-
($this->
|
215 |
else:
|
216 |
return null;
|
217 |
endif;
|
218 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
|
220 |
public function get_category_count(){
|
221 |
-
if($this->params['category_count'] == 'yes'):
|
222 |
return ' (' . get_category($this->lcp_category_id)->category_count . ')';
|
223 |
endif;
|
224 |
}
|
@@ -373,24 +388,24 @@ class CatList{
|
|
373 |
);
|
374 |
$lcp_thumbnail .= '</a>';
|
375 |
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
endif;
|
395 |
return $lcp_thumbnail;
|
396 |
}
|
211 |
$cat_title = get_cat_name($this->lcp_category_id);
|
212 |
|
213 |
return '<a href="' . $cat_link . '" title="' . $cat_title . '">' .
|
214 |
+
($this->lcp_not_empty('catlink_string') ? $this->params['catlink_string'] : $cat_title) . $this->get_category_count() . '</a>';
|
215 |
else:
|
216 |
return null;
|
217 |
endif;
|
218 |
}
|
219 |
+
|
220 |
+
/**
|
221 |
+
* Load morelink name and link to the category:
|
222 |
+
*/
|
223 |
+
public function get_morelink(){
|
224 |
+
if (!empty($this->params['morelink'])) :
|
225 |
+
$href = 'href="' . get_category_link($this->lcp_category_id) . '"';
|
226 |
+
$readmore = ($this->params['morelink'] !== '' ? $this->params['morelink'] : 'More posts');
|
227 |
+
return '<a ' . $href . ' >' . $readmore . '</a>';
|
228 |
+
else:
|
229 |
+
return null;
|
230 |
+
endif;
|
231 |
+
}
|
232 |
+
|
233 |
+
|
234 |
|
235 |
public function get_category_count(){
|
236 |
+
if($this->lcp_not_empty('category_count') && $this->params['category_count'] == 'yes'):
|
237 |
return ' (' . get_category($this->lcp_category_id)->category_count . ')';
|
238 |
endif;
|
239 |
}
|
388 |
);
|
389 |
$lcp_thumbnail .= '</a>';
|
390 |
|
391 |
+
# Check for a YouTube video thumbnail
|
392 |
+
elseif (
|
393 |
+
preg_match("/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^<\s]*)/", $single->post_content, $matches)
|
394 |
+
||
|
395 |
+
preg_match("/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/(v\/)([a-zA-Z0-9\-\_]{11})([^<\s]*)/", $single->post_content, $matches)
|
396 |
+
):
|
397 |
+
$youtubeurl = $matches[0];
|
398 |
|
399 |
+
if ($youtubeurl):
|
400 |
+
$imageurl = "http://i.ytimg.com/vi/{$matches[3]}/1.jpg";
|
401 |
+
endif;
|
402 |
|
403 |
+
$lcp_thumbnail = '<a href="' . get_permalink($single->ID).'">' .
|
404 |
+
'<img src="' . $imageurl .
|
405 |
+
( ($lcp_thumb_class != null) ? 'class="' . $lcp_thumb_class .'"' : null ) .
|
406 |
+
'" alt="' . $single->title . '" />';
|
407 |
+
$lcp_thumbnail .= '</a>';
|
408 |
+
endif;
|
409 |
endif;
|
410 |
return $lcp_thumbnail;
|
411 |
}
|
include/CatListDisplayer.php
CHANGED
@@ -56,7 +56,19 @@ class CatListDisplayer {
|
|
56 |
}
|
57 |
|
58 |
private function build_output($tag){
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
$this->lcp_output .= '<' . $tag;
|
61 |
|
62 |
//Give a class to wrapper tag
|
@@ -76,15 +88,19 @@ class CatListDisplayer {
|
|
76 |
//Close wrapper tag
|
77 |
$this->lcp_output .= '</' . $tag . '>';
|
78 |
|
79 |
-
|
80 |
-
|
81 |
-
$
|
82 |
-
|
83 |
-
|
|
|
|
|
|
|
84 |
endif;
|
85 |
-
|
86 |
-
$this->lcp_output .=
|
87 |
endif;
|
|
|
88 |
}
|
89 |
|
90 |
/**
|
@@ -255,6 +271,11 @@ class CatListDisplayer {
|
|
255 |
$info = $this->catlist->get_category_link();
|
256 |
return $this->assign_style($info, $tag, $css_class);
|
257 |
}
|
|
|
|
|
|
|
|
|
|
|
258 |
|
259 |
private function get_category_count(){
|
260 |
return $this->catlist->get_category_count();
|
56 |
}
|
57 |
|
58 |
private function build_output($tag){
|
59 |
+
// More link
|
60 |
+
if (!empty($this->params['catlink_tag'])):
|
61 |
+
if (!empty($this->params['catlink_class'])):
|
62 |
+
$this->lcp_output .= $this->get_category_link(
|
63 |
+
$this->params['catlink_tag'],
|
64 |
+
$this->params['catlink_class']);
|
65 |
+
else:
|
66 |
+
$this->lcp_output .= $this->get_category_link($this->params['catlink_tag']);
|
67 |
+
endif;
|
68 |
+
else:
|
69 |
+
$this->lcp_output .= $this->get_category_link("strong");
|
70 |
+
endif;
|
71 |
+
|
72 |
$this->lcp_output .= '<' . $tag;
|
73 |
|
74 |
//Give a class to wrapper tag
|
88 |
//Close wrapper tag
|
89 |
$this->lcp_output .= '</' . $tag . '>';
|
90 |
|
91 |
+
// More link
|
92 |
+
if (!empty($this->params['morelink_tag'])):
|
93 |
+
if (!empty($this->params['morelink_class'])):
|
94 |
+
$this->lcp_output .= $this->get_morelink(
|
95 |
+
$this->params['morelink_tag'],
|
96 |
+
$this->params['morelink_class']);
|
97 |
+
else:
|
98 |
+
$this->lcp_output .= $this->get_morelink($this->params['morelink_tag']);
|
99 |
endif;
|
100 |
+
else:
|
101 |
+
$this->lcp_output .= $this->get_morelink();
|
102 |
endif;
|
103 |
+
|
104 |
}
|
105 |
|
106 |
/**
|
271 |
$info = $this->catlist->get_category_link();
|
272 |
return $this->assign_style($info, $tag, $css_class);
|
273 |
}
|
274 |
+
|
275 |
+
private function get_morelink($tag = null, $css_class = null){
|
276 |
+
$info = $this->catlist->get_morelink();
|
277 |
+
return $this->assign_style($info, $tag, $css_class);
|
278 |
+
}
|
279 |
|
280 |
private function get_category_count(){
|
281 |
return $this->catlist->get_category_count();
|
include/ListCategoryPostsWidget.php
CHANGED
@@ -32,9 +32,6 @@ class ListCategoryPostsWidget extends WP_Widget{
|
|
32 |
$thumbnail_size = ($instance['thumbnail_size']) ? $instance['thumbnail_size'] : 'thumbnail';
|
33 |
$morelink = empty($instance['morelink']) ? ' ' : $instance['morelink'];
|
34 |
|
35 |
-
echo $before_widget;
|
36 |
-
echo $before_title . $title . $after_title;
|
37 |
-
|
38 |
$atts = array(
|
39 |
'id' => $category_id,
|
40 |
'orderby' => $orderby,
|
@@ -55,6 +52,15 @@ class ListCategoryPostsWidget extends WP_Widget{
|
|
55 |
'morelink' => $morelink
|
56 |
);
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
$catlist_displayer = new CatListDisplayer($atts);
|
59 |
echo $catlist_displayer->display();
|
60 |
echo $after_widget;
|
32 |
$thumbnail_size = ($instance['thumbnail_size']) ? $instance['thumbnail_size'] : 'thumbnail';
|
33 |
$morelink = empty($instance['morelink']) ? ' ' : $instance['morelink'];
|
34 |
|
|
|
|
|
|
|
35 |
$atts = array(
|
36 |
'id' => $category_id,
|
37 |
'orderby' => $orderby,
|
52 |
'morelink' => $morelink
|
53 |
);
|
54 |
|
55 |
+
echo $before_widget;
|
56 |
+
|
57 |
+
if($title == 'catlink'){
|
58 |
+
//if the user has setup 'catlink' as the title, replace it with the category link:
|
59 |
+
$lcp_category = get_category($category_id);
|
60 |
+
$title = '<a href="' . get_category_link($lcp_category->cat_ID) . '">' . $lcp_category->name . '</a>';
|
61 |
+
}
|
62 |
+
echo $before_title . $title . $after_title;
|
63 |
+
|
64 |
$catlist_displayer = new CatListDisplayer($atts);
|
65 |
echo $catlist_displayer->display();
|
66 |
echo $after_widget;
|
include/lcp_widget_form.php
CHANGED
@@ -16,6 +16,7 @@
|
|
16 |
'exclude'=>'',
|
17 |
'excludeposts'=>'',
|
18 |
'thumbnail' =>'',
|
|
|
19 |
'offset'=>'',
|
20 |
'show_catlink'=>'',
|
21 |
'morelink' =>''
|
@@ -188,7 +189,7 @@
|
|
188 |
<input class="checkbox" input type="checkbox"
|
189 |
<?php checked( (bool) $instance['show_catlink'], true ); ?>
|
190 |
name="<?php echo $this->get_field_name( 'show_catlink' ); ?>" />
|
191 |
-
<?php _e("Link to category", 'list-category-posts')?>
|
192 |
</p>
|
193 |
<p>
|
194 |
<input class="checkbox" input type="checkbox"
|
16 |
'exclude'=>'',
|
17 |
'excludeposts'=>'',
|
18 |
'thumbnail' =>'',
|
19 |
+
'thumbnail_size' =>'',
|
20 |
'offset'=>'',
|
21 |
'show_catlink'=>'',
|
22 |
'morelink' =>''
|
189 |
<input class="checkbox" input type="checkbox"
|
190 |
<?php checked( (bool) $instance['show_catlink'], true ); ?>
|
191 |
name="<?php echo $this->get_field_name( 'show_catlink' ); ?>" />
|
192 |
+
<?php _e("Link to category (use 'catlink' on the title field if you want the title of this widget to be a link to the category)", 'list-category-posts')?>
|
193 |
</p>
|
194 |
<p>
|
195 |
<input class="checkbox" input type="checkbox"
|
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 |
|
@@ -92,6 +92,7 @@ class ListCategoryPosts{
|
|
92 |
'category_count' => '',
|
93 |
'morelink' => '',
|
94 |
'morelink_class' => '',
|
|
|
95 |
'posts_morelink' => '',
|
96 |
'posts_morelink_class' => '',
|
97 |
'year' => '',
|
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.33
|
7 |
Author: Fernando Briano
|
8 |
Author URI: http://picandocodigo.net/
|
9 |
|
92 |
'category_count' => '',
|
93 |
'morelink' => '',
|
94 |
'morelink_class' => '',
|
95 |
+
'morelink_tag' => '',
|
96 |
'posts_morelink' => '',
|
97 |
'posts_morelink_class' => '',
|
98 |
'year' => '',
|
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: 3.3
|
6 |
Tested up to: 3.6.1
|
7 |
-
Stable tag: 0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -256,6 +256,13 @@ Template system has changed. Custom templates should be stored in WordPress them
|
|
256 |
|
257 |
== Changelog ==
|
258 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
259 |
= 0.32 =
|
260 |
* Add category count parameter to show the number of posts in a category next to its title. Only works when using the **catlink** option: `[catlist name=nintendo catlink=yes category_count=yes]` - http://wordpress.org/support/topic/count-feature
|
261 |
|
4 |
Tags: list, categories, posts, cms
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 3.6.1
|
7 |
+
Stable tag: 0.33
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
256 |
|
257 |
== Changelog ==
|
258 |
|
259 |
+
= 0.33 =
|
260 |
+
* Fixes bug with thumbnail size on Widget.
|
261 |
+
* Adds feature to make widget title a link to the category. Use 'catlink' as the value for the widget's title to make it a link to the category (based on https://github.com/picandocodigo/List-Category-Posts/pull/51/).
|
262 |
+
* Fixes morelink styiling with CSS class and tag.
|
263 |
+
* Adds morelink to templates (based on https://github.com/picandocodigo/List-Category-Posts/pull/48/)
|
264 |
+
* Fixes tag and CSS class for "catlink" too: http://wordpress.org/support/topic/cat_link-tag-does-not-seem-to-be-working
|
265 |
+
|
266 |
= 0.32 =
|
267 |
* Add category count parameter to show the number of posts in a category next to its title. Only works when using the **catlink** option: `[catlist name=nintendo catlink=yes category_count=yes]` - http://wordpress.org/support/topic/count-feature
|
268 |
|
templates/default.php
CHANGED
@@ -90,4 +90,8 @@ foreach ($this->catlist->get_categories_posts() as $single):
|
|
90 |
endforeach;
|
91 |
|
92 |
$lcp_display_output .= '</ul>';
|
|
|
|
|
|
|
|
|
93 |
$this->lcp_output = $lcp_display_output;
|
90 |
endforeach;
|
91 |
|
92 |
$lcp_display_output .= '</ul>';
|
93 |
+
|
94 |
+
// If there's a "more link", show it:
|
95 |
+
$lcp_display_output .= $this->catlist->get_morelink();
|
96 |
+
|
97 |
$this->lcp_output = $lcp_display_output;
|