List category posts - Version 0.78.1

Version Description

  • Refactor in widget parameters by @zymeth25, all widget related issues with missing parameters will be gone for good.
Download this release

Release Info

Developer fernandobt
Plugin Icon 128x128 List category posts
Version 0.78.1
Comparing to
See all releases

Code changes from version 0.78 to 0.78.1

Files changed (3) hide show
  1. include/lcp-widget.php +1 -0
  2. list-category-posts.php +116 -107
  3. readme.txt +5 -1
include/lcp-widget.php CHANGED
@@ -70,6 +70,7 @@ class ListCategoryPostsWidget extends WP_Widget{
70
  'pagination' => $pagination,
71
  'instance' => $this->id
72
  );
 
73
 
74
  echo $before_widget;
75
 
70
  'pagination' => $pagination,
71
  'instance' => $this->id
72
  );
73
+ $atts = array_merge(ListCategoryPosts::default_params(), $atts);
74
 
75
  echo $before_widget;
76
 
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.78
7
  Author: Fernando Briano
8
  Author URI: http://fernandobriano.com
9
 
@@ -33,118 +33,127 @@ include 'include/lcp-options.php';
33
  require_once 'include/lcp-catlistdisplayer.php';
34
 
35
  class ListCategoryPosts{
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  /**
37
  * Gets the shortcode parameters and instantiate plugin objects
38
  * @param $atts
39
  * @param $content
40
  */
41
  static function catlist_func($atts, $content = null) {
42
- $atts = shortcode_atts(array(
43
- 'id' => '0',
44
- 'name' => '',
45
- 'orderby' => '',
46
- 'order' => '',
47
- 'numberposts' => '',
48
- 'date' => 'no',
49
- 'date_tag' => '',
50
- 'date_class' =>'',
51
- 'dateformat' => get_option('date_format'),
52
- 'date_modified' => '',
53
- 'date_modified_tag' => '',
54
- 'date_modified_class' => '',
55
- 'author' => 'no',
56
- 'author_posts_link' => 'no',
57
- 'author_tag' =>'',
58
- 'author_class' => '',
59
- 'author_posts' => '',
60
- 'template' => '',
61
- 'excerpt' => 'no',
62
- 'excerpt_size' => '55',
63
- 'excerpt_strip' => 'yes',
64
- 'excerpt_overwrite' => 'no',
65
- 'excerpt_tag' =>'',
66
- 'excerpt_class' =>'',
67
- 'exclude' => '0',
68
- 'excludeposts' => '0',
69
- 'offset' => '0',
70
- 'tags' => '',
71
- 'exclude_tags' => '',
72
- 'currenttags' => '',
73
- 'content' => 'no',
74
- 'content_tag' => '',
75
- 'content_class' => '',
76
- 'display_id' => 'no',
77
- 'catlink' => 'no',
78
- 'catname' => 'no',
79
- 'catlink_string' => '',
80
- 'catlink_tag' =>'',
81
- 'catlink_class' => '',
82
- 'child_categories' => 'yes',
83
- 'comments' => 'no',
84
- 'comments_tag' => '',
85
- 'comments_class' => '',
86
- 'starting_with' => '',
87
- 'thumbnail' => 'no',
88
- 'thumbnail_size' => 'thumbnail',
89
- 'thumbnail_class' => '',
90
- 'force_thumbnail' => '',
91
- 'title_tag' => '',
92
- 'title_class' => '',
93
- 'title_limit' => '0',
94
- 'post_type' => '',
95
- 'post_status' => '',
96
- 'post_parent' => '0',
97
- 'post_suffix' => '',
98
- 'show_protected' => 'no',
99
- 'class' => 'lcp_catlist',
100
- 'conditional_title' => '',
101
- 'conditional_title_tag' => '',
102
- 'conditional_title_class' => '',
103
- 'customfield_name' => '',
104
- 'customfield_value' =>'',
105
- 'customfield_display' =>'',
106
- 'customfield_display_glue' => '',
107
- 'customfield_display_name' =>'',
108
- 'customfield_display_name_glue' => ' : ',
109
- 'customfield_display_separately' => 'no',
110
- 'customfield_orderby' =>'',
111
- 'customfield_tag' => '',
112
- 'customfield_class' => '',
113
- 'taxonomy' => '',
114
- 'taxonomies_and' => '',
115
- 'taxonomies_or' => '',
116
- 'terms' => '',
117
- 'categorypage' => '',
118
- 'category_count' => '',
119
- 'category_description' => 'no',
120
- 'morelink' => '',
121
- 'morelink_class' => '',
122
- 'morelink_tag' => '',
123
- 'posts_morelink' => '',
124
- 'posts_morelink_class' => '',
125
- 'year' => '',
126
- 'monthnum' => '',
127
- 'search' => '',
128
- 'link_target' => '',
129
- 'pagination' => '',
130
- 'pagination_next' => '>>',
131
- 'pagination_prev' => '<<',
132
- 'no_posts_text' => "",
133
- 'instance' => '0',
134
- 'no_post_titles' => 'no',
135
- 'link_titles' => true,
136
- 'link_dates' => 'no',
137
- 'after' => '',
138
- 'after_year' => '',
139
- 'after_month' => '',
140
- 'after_day' => '',
141
- 'before' => '',
142
- 'before_year' => '',
143
- 'before_month' => '',
144
- 'before_day' => '',
145
- 'tags_as_class' => 'no',
146
- 'pagination_bookmarks' => '',
147
- ), $atts);
148
  if($atts['numberposts'] == ''){
149
  $atts['numberposts'] = get_option('numberposts');
150
  }
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.78.1
7
  Author: Fernando Briano
8
  Author URI: http://fernandobriano.com
9
 
33
  require_once 'include/lcp-catlistdisplayer.php';
34
 
35
  class ListCategoryPosts{
36
+ private static $default_params = null;
37
+ public static function default_params(){
38
+ if (self::$default_params === null) {
39
+ self::$default_params = array(
40
+ 'id' => '0',
41
+ 'name' => '',
42
+ 'orderby' => '',
43
+ 'order' => '',
44
+ 'numberposts' => '',
45
+ 'date' => 'no',
46
+ 'date_tag' => '',
47
+ 'date_class' =>'',
48
+ 'dateformat' => get_option('date_format'),
49
+ 'date_modified' => '',
50
+ 'date_modified_tag' => '',
51
+ 'date_modified_class' => '',
52
+ 'author' => 'no',
53
+ 'author_posts_link' => 'no',
54
+ 'author_tag' =>'',
55
+ 'author_class' => '',
56
+ 'author_posts' => '',
57
+ 'template' => '',
58
+ 'excerpt' => 'no',
59
+ 'excerpt_size' => '55',
60
+ 'excerpt_strip' => 'yes',
61
+ 'excerpt_overwrite' => 'no',
62
+ 'excerpt_tag' =>'',
63
+ 'excerpt_class' =>'',
64
+ 'exclude' => '0',
65
+ 'excludeposts' => '0',
66
+ 'offset' => '0',
67
+ 'tags' => '',
68
+ 'exclude_tags' => '',
69
+ 'currenttags' => '',
70
+ 'content' => 'no',
71
+ 'content_tag' => '',
72
+ 'content_class' => '',
73
+ 'display_id' => 'no',
74
+ 'catlink' => 'no',
75
+ 'catname' => 'no',
76
+ 'catlink_string' => '',
77
+ 'catlink_tag' =>'',
78
+ 'catlink_class' => '',
79
+ 'child_categories' => 'yes',
80
+ 'comments' => 'no',
81
+ 'comments_tag' => '',
82
+ 'comments_class' => '',
83
+ 'starting_with' => '',
84
+ 'thumbnail' => 'no',
85
+ 'thumbnail_size' => 'thumbnail',
86
+ 'thumbnail_class' => '',
87
+ 'force_thumbnail' => '',
88
+ 'title_tag' => '',
89
+ 'title_class' => '',
90
+ 'title_limit' => '0',
91
+ 'post_type' => '',
92
+ 'post_status' => '',
93
+ 'post_parent' => '0',
94
+ 'post_suffix' => '',
95
+ 'show_protected' => 'no',
96
+ 'class' => 'lcp_catlist',
97
+ 'conditional_title' => '',
98
+ 'conditional_title_tag' => '',
99
+ 'conditional_title_class' => '',
100
+ 'customfield_name' => '',
101
+ 'customfield_value' =>'',
102
+ 'customfield_display' =>'',
103
+ 'customfield_display_glue' => '',
104
+ 'customfield_display_name' =>'',
105
+ 'customfield_display_name_glue' => ' : ',
106
+ 'customfield_display_separately' => 'no',
107
+ 'customfield_orderby' =>'',
108
+ 'customfield_tag' => '',
109
+ 'customfield_class' => '',
110
+ 'taxonomy' => '',
111
+ 'taxonomies_and' => '',
112
+ 'taxonomies_or' => '',
113
+ 'terms' => '',
114
+ 'categorypage' => '',
115
+ 'category_count' => '',
116
+ 'category_description' => 'no',
117
+ 'morelink' => '',
118
+ 'morelink_class' => '',
119
+ 'morelink_tag' => '',
120
+ 'posts_morelink' => '',
121
+ 'posts_morelink_class' => '',
122
+ 'year' => '',
123
+ 'monthnum' => '',
124
+ 'search' => '',
125
+ 'link_target' => '',
126
+ 'pagination' => '',
127
+ 'pagination_next' => '>>',
128
+ 'pagination_prev' => '<<',
129
+ 'no_posts_text' => "",
130
+ 'instance' => '0',
131
+ 'no_post_titles' => 'no',
132
+ 'link_titles' => true,
133
+ 'link_dates' => 'no',
134
+ 'after' => '',
135
+ 'after_year' => '',
136
+ 'after_month' => '',
137
+ 'after_day' => '',
138
+ 'before' => '',
139
+ 'before_year' => '',
140
+ 'before_month' => '',
141
+ 'before_day' => '',
142
+ 'tags_as_class' => 'no',
143
+ 'pagination_bookmarks' => '',
144
+ );
145
+ }
146
+ return self::$default_params;
147
+ }
148
+
149
  /**
150
  * Gets the shortcode parameters and instantiate plugin objects
151
  * @param $atts
152
  * @param $content
153
  */
154
  static function catlist_func($atts, $content = null) {
155
+ $atts = shortcode_atts(self::default_params(), $atts);
156
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  if($atts['numberposts'] == ''){
158
  $atts['numberposts'] = get_option('numberposts');
159
  }
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: list, categories, posts, cms
5
  Requires at least: 3.3
6
  Tested up to: 4.9.7
7
  Requires PHP: 5.2.4
8
- Stable tag: 0.78
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -440,6 +440,10 @@ Template system has changed. Custom templates should be stored in WordPress them
440
 
441
  == Changelog ==
442
 
 
 
 
 
443
  = 0.78 =
444
 
445
  * Adds `before=today`, when you use it the plugin will get today's date dynamically and display only old posts. Thanks @nnasirzada for the PR implementing this!
5
  Requires at least: 3.3
6
  Tested up to: 4.9.7
7
  Requires PHP: 5.2.4
8
+ Stable tag: 0.78.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
440
 
441
  == Changelog ==
442
 
443
+ = 0.78.1 =
444
+
445
+ * Refactor in widget parameters by @zymeth25, all widget related issues with missing parameters will be gone for good.
446
+
447
  = 0.78 =
448
 
449
  * Adds `before=today`, when you use it the plugin will get today's date dynamically and display only old posts. Thanks @nnasirzada for the PR implementing this!