Category Posts Widget - Version 4.8.2

Version Description

  • January 30th 2018 =
  • Fixed Adding the widget with the customizer only the title is shown
  • Fixed Recognize "Empty lines" > Next line is a paragraph in the Template in widget areas
Download this release

Release Info

Developer Kometschuh
Plugin Icon 128x128 Category Posts Widget
Version 4.8.2
Comparing to
See all releases

Code changes from version 4.8.1 to 4.8.2

Files changed (2) hide show
  1. cat-posts.php +26 -19
  2. readme.txt +23 -27
cat-posts.php CHANGED
@@ -12,7 +12,7 @@ Plugin Name: Category Posts Widget
12
  Plugin URI: https://wordpress.org/plugins/category-posts/
13
  Description: Adds a widget that shows the most recent posts from a single category.
14
  Author: TipTopPress
15
- Version: 4.8.1
16
  Author URI: http://tiptoppress.com
17
  Text Domain: category-posts
18
  Domain Path: /languages
@@ -25,7 +25,7 @@ if ( ! defined( 'ABSPATH' ) ) {
25
  exit;
26
  }
27
 
28
- const VERSION = '4.8.beta2';
29
  const DOC_URL = 'http://tiptoppress.com/category-posts-widget/documentation-4-8?utm_source=widget_cpw&utm_campaign=documentation_4_8_cpw&utm_medium=form';
30
  const PRO_URL = 'http://tiptoppress.com/term-and-category-based-posts-widget/?utm_source=widget_cpw&utm_campaign=get_pro_cpw&utm_medium=action_link';
31
  const SUPPORT_URL = 'https://wordpress.org/support/plugin/category-posts';
@@ -1165,11 +1165,13 @@ class Widget extends \WP_Widget {
1165
 
1166
  // Replace empty line with closing and opening DIV.
1167
  $template_res = trim( $template_res );
1168
- $template_res = str_replace( "\n\n", '</div><div>', $template_res );
 
1169
  $template_res = '<div>' . $template_res . '</div>';
1170
 
1171
  // replace new lines with spaces.
1172
- $template_res = str_replace( "\n\n", ' ', $template_res );
 
1173
 
1174
  $ret .= $template_res;
1175
 
@@ -1255,6 +1257,10 @@ class Widget extends \WP_Widget {
1255
  * @since 4.1
1256
  */
1257
  public function widget( $args, $instance ) {
 
 
 
 
1258
 
1259
  extract( $args );
1260
  $this->instance = $instance;
@@ -1303,8 +1309,6 @@ class Widget extends \WP_Widget {
1303
  if ( $use_css_cropping ) {
1304
  // enqueue relevant scripts and parameters to perform cropping
1305
  // once we support only 4.5+ it can be refactored to use wp_add_inline_script.
1306
- wp_enqueue_script( 'jquery' ); // just in case the theme or other plugins didn't enqueue it.
1307
- add_action( 'wp_footer', __NAMESPACE__ . '\change_cropped_image_dimensions', 100 ); // add to the footer the cropping script.
1308
  $number = $this->number;
1309
  // a temporary hack to handle difference in the number in a true widget
1310
  // and the number format expected at the rest of the places.
@@ -1321,6 +1325,8 @@ class Widget extends \WP_Widget {
1321
  return $a;
1322
  }
1323
  );
 
 
1324
  }
1325
  }
1326
  }
@@ -1752,7 +1758,7 @@ class Widget extends \WP_Widget {
1752
  <p><?php esc_html_e( 'Displayed parts', 'category-posts' ); ?></p>
1753
  <div class="cpwp_ident">
1754
  <?php
1755
- echo $this->get_textarea_html( $instance, 'template', esc_html__( 'Template', 'category-posts' ) . ' <a href="#" class="dashicons toggle-template-help dashicons-editor-help imgedit-help-toggle"><span class="screen-reader-text">' . esc_html__( 'Show template help', 'category-posts' ) . '</span></a>', $template, '', true, 5 );
1756
  preg_match_all( get_template_regex(), $template, $matches );
1757
  $tags = array();
1758
  if ( ! empty( $matches[0] ) ) {
@@ -1823,7 +1829,7 @@ class Widget extends \WP_Widget {
1823
  <p><?php esc_html_e( 'Excerpt settings', 'category-posts' ); ?></p>
1824
  <div class="cpwp_ident">
1825
  <?php
1826
- echo $this->get_number_input_block_html( $instance, 'excerpt_length', esc_html__( 'Excerpt length (words):', 'category-posts' ), get_option( 'posts_per_page' ), 1, 55, '', true );
1827
  echo $this->get_text_input_block_html( $instance, 'excerpt_more_text', esc_html__( 'Excerpt \'more\' text:', 'category-posts' ), '', esc_attr__( '...', 'category-posts' ), true );
1828
  echo $this->get_checkbox_block_html( $instance, 'excerpt_filters', esc_html__( 'Don\'t override Themes and plugin filters', 'category-posts' ), false, true );
1829
  ?>
@@ -1970,8 +1976,7 @@ add_action( 'widgets_init', __NAMESPACE__ . '\register_widget' );
1970
  *
1971
  * @since 4.7
1972
  */
1973
- function change_cropped_image_dimensions() {
1974
- ?>
1975
  <script type="text/javascript">
1976
 
1977
  if (typeof jQuery !== 'undefined') {
@@ -2036,7 +2041,7 @@ function change_cropped_image_dimensions() {
2036
  },
2037
  }
2038
 
2039
- <?php
2040
  /**
2041
  * The cpw_crop_widgets is an internal filter that is used
2042
  * to gather the ids of the widgets to which apply cropping
@@ -2045,13 +2050,15 @@ function change_cropped_image_dimensions() {
2045
  * in the array while the ratio of width/height be the value
2046
  */
2047
  $widgets_ids = apply_filters( 'cpw_crop_widgets', array() );
2048
- foreach ( $widgets_ids as $number => $ratio ) {
2049
- ?>
2050
- cwp_namespace.fluid_images.widget = jQuery('#<?php echo esc_attr( $number ); ?>');
2051
- cwp_namespace.fluid_images.Widgets['<?php echo esc_attr( $number ); ?>'] = new cwp_namespace.fluid_images.WidgetPosts(cwp_namespace.fluid_images.widget,<?php echo esc_attr( $ratio ); ?>);
2052
- <?php } ?>
2053
-
2054
- <?php /* do on page load or on resize the browser window */ echo "\r\n"; ?>
 
 
2055
  jQuery(window).on('load resize', function() {
2056
  for (var widget in cwp_namespace.fluid_images.Widgets) {
2057
  cwp_namespace.fluid_images.Widgets[widget].changeImageSize();
@@ -2060,7 +2067,7 @@ function change_cropped_image_dimensions() {
2060
  });
2061
  }
2062
  </script>
2063
- <?php
2064
  }
2065
 
2066
  /*
12
  Plugin URI: https://wordpress.org/plugins/category-posts/
13
  Description: Adds a widget that shows the most recent posts from a single category.
14
  Author: TipTopPress
15
+ Version: 4.8.2
16
  Author URI: http://tiptoppress.com
17
  Text Domain: category-posts
18
  Domain Path: /languages
25
  exit;
26
  }
27
 
28
+ const VERSION = '4.8.2';
29
  const DOC_URL = 'http://tiptoppress.com/category-posts-widget/documentation-4-8?utm_source=widget_cpw&utm_campaign=documentation_4_8_cpw&utm_medium=form';
30
  const PRO_URL = 'http://tiptoppress.com/term-and-category-based-posts-widget/?utm_source=widget_cpw&utm_campaign=get_pro_cpw&utm_medium=action_link';
31
  const SUPPORT_URL = 'https://wordpress.org/support/plugin/category-posts';
1165
 
1166
  // Replace empty line with closing and opening DIV.
1167
  $template_res = trim( $template_res );
1168
+ $template_res = str_replace( "\n\r", '</div><div>', $template_res ); // in widget areas
1169
+ $template_res = str_replace( "\n\n", '</div><div>', $template_res ); // as shortcode
1170
  $template_res = '<div>' . $template_res . '</div>';
1171
 
1172
  // replace new lines with spaces.
1173
+ $template_res = str_replace( "\n\r", ' ', $template_res ); // in widget areas
1174
+ $template_res = str_replace( "\n\n", ' ', $template_res ); // as shortcode
1175
 
1176
  $ret .= $template_res;
1177
 
1257
  * @since 4.1
1258
  */
1259
  public function widget( $args, $instance ) {
1260
+
1261
+ if ( 0 === count( $instance ) ) {
1262
+ $instance = default_settings();
1263
+ }
1264
 
1265
  extract( $args );
1266
  $this->instance = $instance;
1309
  if ( $use_css_cropping ) {
1310
  // enqueue relevant scripts and parameters to perform cropping
1311
  // once we support only 4.5+ it can be refactored to use wp_add_inline_script.
 
 
1312
  $number = $this->number;
1313
  // a temporary hack to handle difference in the number in a true widget
1314
  // and the number format expected at the rest of the places.
1325
  return $a;
1326
  }
1327
  );
1328
+ wp_enqueue_script( 'jquery' ); // just in case the theme or other plugins didn't enqueue it.
1329
+ add_action('wp_footer',function () use ($number,$instance) { __NAMESPACE__ . '\\' . change_cropped_image_dimensions($number,$instance);},100);
1330
  }
1331
  }
1332
  }
1758
  <p><?php esc_html_e( 'Displayed parts', 'category-posts' ); ?></p>
1759
  <div class="cpwp_ident">
1760
  <?php
1761
+ echo $this->get_textarea_html( $instance, 'template', esc_html__( 'Template', 'category-posts' ) . ' <a href="#" class="dashicons toggle-template-help dashicons-editor-help imgedit-help-toggle"><span class="screen-reader-text">' . esc_html__( 'Show template help', 'category-posts' ) . '</span></a>', $template, '', true, 8 );
1762
  preg_match_all( get_template_regex(), $template, $matches );
1763
  $tags = array();
1764
  if ( ! empty( $matches[0] ) ) {
1829
  <p><?php esc_html_e( 'Excerpt settings', 'category-posts' ); ?></p>
1830
  <div class="cpwp_ident">
1831
  <?php
1832
+ echo $this->get_number_input_block_html( $instance, 'excerpt_length', esc_html__( 'Excerpt length (words):', 'category-posts' ), get_option( 'posts_per_page' ), 1, 200, '', true );
1833
  echo $this->get_text_input_block_html( $instance, 'excerpt_more_text', esc_html__( 'Excerpt \'more\' text:', 'category-posts' ), '', esc_attr__( '...', 'category-posts' ), true );
1834
  echo $this->get_checkbox_block_html( $instance, 'excerpt_filters', esc_html__( 'Don\'t override Themes and plugin filters', 'category-posts' ), false, true );
1835
  ?>
1976
  *
1977
  * @since 4.7
1978
  */
1979
+ function change_cropped_image_dimensions($number,$widgetsettings) { ?>
 
1980
  <script type="text/javascript">
1981
 
1982
  if (typeof jQuery !== 'undefined') {
2041
  },
2042
  }
2043
 
2044
+ <?php
2045
  /**
2046
  * The cpw_crop_widgets is an internal filter that is used
2047
  * to gather the ids of the widgets to which apply cropping
2050
  * in the array while the ratio of width/height be the value
2051
  */
2052
  $widgets_ids = apply_filters( 'cpw_crop_widgets', array() );
2053
+ foreach ( $widgets_ids as $num => $ratio ) {
2054
+ if($num != $number) {
2055
+ continue;
2056
+ } ?>
2057
+ cwp_namespace.fluid_images.widget = jQuery('#<?php echo esc_attr( $num ); ?>');
2058
+ cwp_namespace.fluid_images.Widgets['<?php echo esc_attr( $num ); ?>'] = new cwp_namespace.fluid_images.WidgetPosts(cwp_namespace.fluid_images.widget,<?php echo esc_attr( $ratio ); ?>);
2059
+ <?php } ?>
2060
+
2061
+ <?php /* do on page load or on resize the browser window */ echo "\r\n"; ?>
2062
  jQuery(window).on('load resize', function() {
2063
  for (var widget in cwp_namespace.fluid_images.Widgets) {
2064
  cwp_namespace.fluid_images.Widgets[widget].changeImageSize();
2067
  });
2068
  }
2069
  </script>
2070
+ <?php
2071
  }
2072
 
2073
  /*
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
- === Category Posts Widget ===
2
  Contributors: mark-k, kometschuh, mkrdip
3
  Donate link: http://mkrdip.me/donate
4
  Tags: category, categories, posts, widget, posts widget, recent posts, category recent posts, shortcode, sidebar, excerpt, multiple widgets
5
  Requires at least: 2.8
6
  Tested up to: 4.9
7
- Stable tag: 4.8.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -34,13 +34,13 @@ We've also started creating free widget Add-ons for the Premium Widget here: [Wi
34
  * More examples on the [demo pages](http://demo.tiptoppress.com/?utm_source=wordpress_org&utm_campaign=demo_cpw&utm_medium=web)
35
 
36
  = Features =
37
- * SVG icon support for post formats
38
- * Template to arrange the post details
39
  * Premade Templates
40
- * The Template text can be a placeholder, plain text, HTML or HTML for icons
41
  * New date format: Time since plublished
42
  * Filter by post status: Published, scheduled, private
43
- * New hover effect: SVG icon
44
  * Shortcode (Easily change all Shortcode options in the customizer).
45
  * Support multiple shortcodes at the same post.
46
  * Add option for post offset (use two or more widgets after another).
@@ -91,11 +91,11 @@ While using this plugin if you find any bug or any conflict, please submit an is
91
 
92
  == Installation ==
93
  = Automatic installation =
94
- Automatic installation is the easiest option as WordPress handles the file transfers itself and you dont need to leave your web browser. To do an automatic install of Category Posts Widget,
95
 
96
  1. log in to your WordPress dashboard, navigate to the Plugins menu and click Add New.
97
- 2. In the search field type Category Posts Widget and click Search Plugins.
98
- 3. Once youve found plugin, you can install it by simply clicking Install Now�.
99
  4. Then, go to plugins page of WordPress admin activate the plugin.
100
  5. Now, goto the Widgets page of the Appearance section and configure the Category Posts widget.
101
 
@@ -112,27 +112,19 @@ Automatic installation is the easiest option as WordPress handles the file trans
112
 
113
  == Frequently Asked Questions ==
114
  = Template, placeholder and post detail =
115
- Here You can control the [Post Detail parts](http://tiptoppress.com/category-posts-widget/documentation-4-8/#Post_details), which appears as part of the post item. All post detail will placed as placeholder. The text in the Template area can be a placeholder, plain text, HTML code or HTML code for icons.
 
 
 
 
116
 
117
  = Use SVG icons =
118
- For SVG icon HTML we recommend the [WordPress Dashicons](https://developer.wordpress.org/resource/dashicons/), which are included as default and can be used without any icon-font including.
119
 
120
  = How Category Posts Widget work with SiteOrigin Page Builder =
121
  Please add the widget with shortcode [catposts] inside a editor widget which is placed to a SiteOrigin Page Builder row.
122
  We also create a YouTube video: [How Category Posts Widget work with SiteOrigin Page Builder](http://tiptoppress.com/how-category-posts-widget-work-with-siteorigin-page-builder/)
123
 
124
- = Thumb and Title not able to float left =
125
- Check the option in the Thumbnails panels > "Show thumbnails above text".
126
- Then add this custom CSS:
127
-
128
- `.cat-post-thumbnail {
129
- float: left !important;
130
- }`
131
-
132
- If you use wordpress 4.7 or higher you can [add this custom CSS with the customizer](http://kometschuh.de/Easily-adding-custom-CSS-using-the-WordPress-Theme-customizer.html/?utm_source=wordpress_org&utm_campaign=faq_cpw&utm_medium=web)
133
-
134
- For more layout options please try our premium widget: [Term and Category based Posts Widget](http://tiptoppress.com/term-and-category-based-posts-widget/?utm_source=wordpress_org&utm_campaign=faq_cpw&utm_medium=web).
135
-
136
  = The font-size is different from that of other widgets or Theme elements? =
137
  Please use the option: "Disable widget CSS".
138
 
@@ -149,7 +141,7 @@ We know there are peopel how use PHP 5.2 [wordpress.org/about/stats](https://wor
149
  Check also the .htaccess file, if there is an entry for an older PHP version.
150
 
151
  == Screenshots ==
152
- 1. Front end of the widget with SVG icon support for post formats, hover effects and the Template text-area.
153
  2. Template to arrange the post details with placeholders.
154
  3. Edit the widget options with the customizer.
155
  4. Use shortcode [catposts] in the content.
@@ -159,16 +151,20 @@ Check also the .htaccess file, if there is an entry for an older PHP version.
159
  == Changelog ==
160
  [Read more on our blog ...](http://tiptoppress.com/category/category-posts-widget?utm_source=wordpress_org&utm_campaign=changelog_cpw&utm_medium=web)
161
 
 
 
 
 
162
  = 4.8.1 - January 25th 2018 =
163
- * Fixed Recognize "Empty lines" > Next line is a paragraph in the Templaste
164
 
165
  = 4.8 - January 22th 2018 =
166
- * SVG icon support for post formats
167
  * Template to arrange the post details
168
  * Premade Templates
169
  * Date format: Time since plublished
170
  * Filter by post status: Published, scheduled, private
171
- * Hover effect: SVG icon
172
 
173
  = 4.7.4 - October 21th 2017 =
174
  * Bugfix for filter by post status (note private)
1
+ === Category Posts Widget ===
2
  Contributors: mark-k, kometschuh, mkrdip
3
  Donate link: http://mkrdip.me/donate
4
  Tags: category, categories, posts, widget, posts widget, recent posts, category recent posts, shortcode, sidebar, excerpt, multiple widgets
5
  Requires at least: 2.8
6
  Tested up to: 4.9
7
+ Stable tag: 4.8.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
34
  * More examples on the [demo pages](http://demo.tiptoppress.com/?utm_source=wordpress_org&utm_campaign=demo_cpw&utm_medium=web)
35
 
36
  = Features =
37
+ * SVG font-icon support for post formats
38
+ * [Template](http://tiptoppress.com/template-arrange-post-details/) to arrange the post details
39
  * Premade Templates
40
+ * The Template text can be a post details placeholder, plain text, HTML or HTML for SVG font-icons
41
  * New date format: Time since plublished
42
  * Filter by post status: Published, scheduled, private
43
+ * New hover effect: SVG font-icon
44
  * Shortcode (Easily change all Shortcode options in the customizer).
45
  * Support multiple shortcodes at the same post.
46
  * Add option for post offset (use two or more widgets after another).
91
 
92
  == Installation ==
93
  = Automatic installation =
94
+ Automatic installation is the easiest option as WordPress handles the file transfers itself and you dont need to leave your web browser. To do an automatic install of Category Posts Widget,
95
 
96
  1. log in to your WordPress dashboard, navigate to the Plugins menu and click Add New.
97
+ 2. In the search field type Category Posts Widget and click Search Plugins.
98
+ 3. Once youve found plugin, you can install it by simply clicking Install Now”.
99
  4. Then, go to plugins page of WordPress admin activate the plugin.
100
  5. Now, goto the Widgets page of the Appearance section and configure the Category Posts widget.
101
 
112
 
113
  == Frequently Asked Questions ==
114
  = Template, placeholder and post detail =
115
+ Here You can control the [Post Detail parts](http://tiptoppress.com/category-posts-widget/documentation-4-8/#Post_details), which appears as part of the post item. All post detail will placed as placeholder. The text in the Template area can be a post details placeholder, plain text, HTML or HTML for SVG icons.
116
+
117
+ [How it works? and examples.](http://tiptoppress.com/template-arrange-post-details/)
118
+
119
+ For more layout options please try our premium widget: [Term and Category based Posts Widget](http://tiptoppress.com/term-and-category-based-posts-widget/).
120
 
121
  = Use SVG icons =
122
+ For SVG font-icon HTML we recommend the [WordPress Dashicons](https://developer.wordpress.org/resource/dashicons/), which are included as default and can be used without any font-icon including.
123
 
124
  = How Category Posts Widget work with SiteOrigin Page Builder =
125
  Please add the widget with shortcode [catposts] inside a editor widget which is placed to a SiteOrigin Page Builder row.
126
  We also create a YouTube video: [How Category Posts Widget work with SiteOrigin Page Builder](http://tiptoppress.com/how-category-posts-widget-work-with-siteorigin-page-builder/)
127
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  = The font-size is different from that of other widgets or Theme elements? =
129
  Please use the option: "Disable widget CSS".
130
 
141
  Check also the .htaccess file, if there is an entry for an older PHP version.
142
 
143
  == Screenshots ==
144
+ 1. Front end of the widget with SVG font-icon support for post formats, hover effects and the Template text-area.
145
  2. Template to arrange the post details with placeholders.
146
  3. Edit the widget options with the customizer.
147
  4. Use shortcode [catposts] in the content.
151
  == Changelog ==
152
  [Read more on our blog ...](http://tiptoppress.com/category/category-posts-widget?utm_source=wordpress_org&utm_campaign=changelog_cpw&utm_medium=web)
153
 
154
+ = 4.8.2 - January 30th 2018 =
155
+ * Fixed Adding the widget with the customizer only the title is shown
156
+ * Fixed Recognize "Empty lines" > Next line is a paragraph in the Template in widget areas
157
+
158
  = 4.8.1 - January 25th 2018 =
159
+ * Fixed Recognize "Empty lines" > Next line is a paragraph in the Template
160
 
161
  = 4.8 - January 22th 2018 =
162
+ * SVG font-icon support for post formats
163
  * Template to arrange the post details
164
  * Premade Templates
165
  * Date format: Time since plublished
166
  * Filter by post status: Published, scheduled, private
167
+ * Hover effect: SVG font-icon
168
 
169
  = 4.7.4 - October 21th 2017 =
170
  * Bugfix for filter by post status (note private)