Newpost Catch - Version 1.2.6

Version Description

  • Compatibility check with WP 4.1 and Twenty Fifteen Theme.
Download this release

Release Info

Developer s56bouya
Plugin Icon wp plugin Newpost Catch
Version 1.2.6
Comparing to
See all releases

Code changes from version 1.2.2 to 1.2.6

class.php CHANGED
@@ -5,7 +5,7 @@
5
  if ( !class_exists('NewpostCatch') ) {
6
  class NewpostCatch extends WP_Widget {
7
  /*** variables ***/
8
- var $version = "1.2.2";
9
  var $pluginDir = "";
10
 
11
  /*** structure ***/
@@ -60,13 +60,18 @@ if ( !class_exists('NewpostCatch') ) {
60
  function widget($args, $instance) {
61
  extract( $args );
62
 
63
- $title = apply_filters('NewpostCatch_widget_title', $instance['title']);
64
- $width = apply_filters('NewpostCatch_widget_width', $instance['width']);
65
- $height = apply_filters('NewpostCatch_widget_height', $instance['height']);
66
- $number = apply_filters('NewpostCatch_widget_number', $instance['number']);
67
- $ignore = apply_filters('NewpostCatch_widget_ignore', $instance['ignore_check']['active']);
68
- $css = apply_filters('NewpostCatch_widget_css', $instance['css']);
69
- $cat = apply_filters('NewpostCatch_widget_cat', $instance['cat']);
 
 
 
 
 
70
  /* if( $instance['ignore_check']['active'] = !false ) { $ignore = 1; } else { $ignore = 0; }*/
71
 
72
  if( !function_exists('no_thumb_image') ){
@@ -90,7 +95,7 @@ if ( !class_exists('NewpostCatch') ) {
90
  $sticky = get_option( 'sticky_posts' );
91
  if( $ignore == !false ){
92
  $npc_query = new WP_Query( array(
93
- 'post_type' => 'post',
94
  'cat' => $cat,
95
  'posts_per_page' => $number,
96
  'ignore_sticky_posts' => 0,
@@ -99,7 +104,7 @@ if ( !class_exists('NewpostCatch') ) {
99
  ));
100
  } else {
101
  $npc_query = new WP_Query( array(
102
- 'post_type' => 'post',
103
  'cat' => $cat,
104
  'posts_per_page' => $number,
105
  'post_not_in' => $sticky,
@@ -164,6 +169,7 @@ $thumb_url = $thumb_url[0];
164
  $instance['date']['active'] = $new_instance['date'];
165
  $instance['ignore_check']['active'] = $new_instance['ignore_check']['active'];
166
  $instance['css']['active'] = $new_instance['css'];
 
167
 
168
  update_option('newpost_catch', $instance);
169
 
@@ -182,7 +188,8 @@ $thumb_url = $thumb_url[0];
182
  'date' => array( 'active' => false ),
183
  'ignore_check' => array( 'active' => false ),
184
  'css' => array( 'active' => true ),
185
- 'cat' => NULL
 
186
  );
187
 
188
  $instance = wp_parse_args( (array) $instance, $defaults );
@@ -194,10 +201,10 @@ $thumb_url = $thumb_url[0];
194
  <p>
195
  <?php _e('Thumbnail Size' , 'newpost-catch'); ?><br />
196
  <label for="<?php echo $this->get_field_id('width'); ?>"><?php _e('Width' , 'newpost-catch'); ?></label>
197
- <input id="<?php echo $this->get_field_id('width'); ?>" name="<?php echo $this->get_field_name( 'width' ); ?>" type="text" style="width:30px" value="<?php echo esc_attr($instance['width']); ?>" /> px
198
  <br />
199
  <label for="<?php echo $this->get_field_id('height'); ?>"><?php _e('Height' , 'newpost-catch'); ?></label>
200
- <input id="<?php echo $this->get_field_id('height'); ?>" name="<?php echo $this->get_field_name('height'); ?>" type="text" style="width:30px;" value="<?php echo esc_attr($instance['height']); ?>" /> px
201
  </p>
202
  <p>
203
  <label for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Show post(s)' , 'newpost-catch'); ?></label>
@@ -212,11 +219,31 @@ $thumb_url = $thumb_url[0];
212
  <p>
213
  <input type="checkbox" class="checkbox" <?php if($instance['css']['active']){ echo 'checked="checked"'; } else { echo ''; } ?> id="<?php echo $this->get_field_id( 'css' ); ?>" name="<?php echo $this->get_field_name( 'css' ); ?>" /> <label for="<?php echo $this->get_field_id( 'css' ); ?>"><?php _e('Use default css', 'newpost-catch'); ?></label>
214
  </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
215
  <p>
216
  <label for="<?php echo $this->get_field_id('cat'); ?>"><?php _e('Display category(ies)' , 'newpost-catch'); ?></label>
217
  <input id="<?php echo $this->get_field_id('cat'); ?>" name="<?php echo $this->get_field_name('cat'); ?>" type="text" class="widefat" value="<?php echo esc_attr($instance['cat']); ?>" />
218
  <span><a href="<?php echo get_bloginfo('url') . '/wp-admin/edit-tags.php?taxonomy=category'; ?>"><?php _e('Check the category ID' , 'newpost-catch'); ?></a></span>
219
  </p>
 
220
  <p>
221
  <?php _e('Use shortcode' , 'newpost-catch'); ?>
222
  <?php _e('Can use the shortcode in a textwidget and theme files.' , 'newpost-catch'); ?> <a href="http://wordpress.org/plugins/newpost-catch/faq/" target="_blank">FAQ</a>
@@ -257,6 +284,7 @@ if ( !class_exists('NewpostCatch_SC') ) {
257
  /** default value **/
258
  extract( shortcode_atts( array(
259
  'id' => "npcatch",
 
260
  'cat' => NULL,
261
  'width' => 10,
262
  'height' => 10,
@@ -287,6 +315,7 @@ if ( !class_exists('NewpostCatch_SC') ) {
287
 
288
  /** query **/
289
  $npc_sc_query = new WP_Query( array(
 
290
  'cat' => $cat,
291
  'offset' => $offset,
292
  'posts_per_page' => $posts_per_page,
5
  if ( !class_exists('NewpostCatch') ) {
6
  class NewpostCatch extends WP_Widget {
7
  /*** variables ***/
8
+ var $version = "1.2.6";
9
  var $pluginDir = "";
10
 
11
  /*** structure ***/
60
  function widget($args, $instance) {
61
  extract( $args );
62
 
63
+ $title = apply_filters('NewpostCatch_widget_title', $instance['title']);
64
+ $width = apply_filters('NewpostCatch_widget_width', $instance['width']);
65
+ $height = apply_filters('NewpostCatch_widget_height', $instance['height']);
66
+ $number = apply_filters('NewpostCatch_widget_number', $instance['number']);
67
+ $ignore = apply_filters('NewpostCatch_widget_ignore', $instance['ignore_check']['active']);
68
+ $css = apply_filters('NewpostCatch_widget_css', $instance['css']);
69
+ $cat = apply_filters('NewpostCatch_widget_cat', $instance['cat']);
70
+ if( !empty($instance['post_type']) ){
71
+ $post_type = apply_filters('NewpostCatch_widget_post_type', $instance['post_type']);
72
+ } else {
73
+ $post_type = apply_filters('NewpostCatch_widget_post_type', 'post');
74
+ }
75
  /* if( $instance['ignore_check']['active'] = !false ) { $ignore = 1; } else { $ignore = 0; }*/
76
 
77
  if( !function_exists('no_thumb_image') ){
95
  $sticky = get_option( 'sticky_posts' );
96
  if( $ignore == !false ){
97
  $npc_query = new WP_Query( array(
98
+ 'post_type' => $post_type,
99
  'cat' => $cat,
100
  'posts_per_page' => $number,
101
  'ignore_sticky_posts' => 0,
104
  ));
105
  } else {
106
  $npc_query = new WP_Query( array(
107
+ 'post_type' => $post_type,
108
  'cat' => $cat,
109
  'posts_per_page' => $number,
110
  'post_not_in' => $sticky,
169
  $instance['date']['active'] = $new_instance['date'];
170
  $instance['ignore_check']['active'] = $new_instance['ignore_check']['active'];
171
  $instance['css']['active'] = $new_instance['css'];
172
+ $instance['post_type'] = !empty($new_instance['post_type']) ? $new_instance['post_type'] : 'post';
173
 
174
  update_option('newpost_catch', $instance);
175
 
188
  'date' => array( 'active' => false ),
189
  'ignore_check' => array( 'active' => false ),
190
  'css' => array( 'active' => true ),
191
+ 'cat' => NULL,
192
+ 'post_type' => 'post',
193
  );
194
 
195
  $instance = wp_parse_args( (array) $instance, $defaults );
201
  <p>
202
  <?php _e('Thumbnail Size' , 'newpost-catch'); ?><br />
203
  <label for="<?php echo $this->get_field_id('width'); ?>"><?php _e('Width' , 'newpost-catch'); ?></label>
204
+ <input id="<?php echo $this->get_field_id('width'); ?>" name="<?php echo $this->get_field_name( 'width' ); ?>" type="text" style="width:50px" value="<?php echo esc_attr($instance['width']); ?>" /> px
205
  <br />
206
  <label for="<?php echo $this->get_field_id('height'); ?>"><?php _e('Height' , 'newpost-catch'); ?></label>
207
+ <input id="<?php echo $this->get_field_id('height'); ?>" name="<?php echo $this->get_field_name('height'); ?>" type="text" style="width:50px;" value="<?php echo esc_attr($instance['height']); ?>" /> px
208
  </p>
209
  <p>
210
  <label for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Show post(s)' , 'newpost-catch'); ?></label>
219
  <p>
220
  <input type="checkbox" class="checkbox" <?php if($instance['css']['active']){ echo 'checked="checked"'; } else { echo ''; } ?> id="<?php echo $this->get_field_id( 'css' ); ?>" name="<?php echo $this->get_field_name( 'css' ); ?>" /> <label for="<?php echo $this->get_field_id( 'css' ); ?>"><?php _e('Use default css', 'newpost-catch'); ?></label>
221
  </p>
222
+ <?php _e('Post types' , 'newpost-catch'); ?><br />
223
+ <?php
224
+ $args = array(
225
+ 'public' => true,
226
+ );
227
+
228
+ $output = 'objects';
229
+ $operator = 'and';
230
+
231
+ $post_types = get_post_types( $args, $output, $operator );
232
+ foreach ( $post_types as $post_type ) {
233
+ if( $post_type->name !== 'attachment' ){
234
+ ?>
235
+ <p><input type="radio" id="<?php echo $this->get_field_name($post_type->name); ?>" name="<?php echo $this->get_field_name('post_type'); ?>" value="<?php echo $post_type->name; ?>" <?php echo ( $instance['post_type'] == $post_type->name ) ? 'checked="checked"' : ''; ?> > <label for="<?php echo $this->get_field_name($post_type->name); ?>"><?php echo $post_type->labels->singular_name . '(' . $post_type->name . ')'; ?></label></p>
236
+ <?php
237
+ }
238
+ }
239
+ ?>
240
+ <?php if( $instance['post_type'] == 'post' ){ ?>
241
  <p>
242
  <label for="<?php echo $this->get_field_id('cat'); ?>"><?php _e('Display category(ies)' , 'newpost-catch'); ?></label>
243
  <input id="<?php echo $this->get_field_id('cat'); ?>" name="<?php echo $this->get_field_name('cat'); ?>" type="text" class="widefat" value="<?php echo esc_attr($instance['cat']); ?>" />
244
  <span><a href="<?php echo get_bloginfo('url') . '/wp-admin/edit-tags.php?taxonomy=category'; ?>"><?php _e('Check the category ID' , 'newpost-catch'); ?></a></span>
245
  </p>
246
+ <?php } ?>
247
  <p>
248
  <?php _e('Use shortcode' , 'newpost-catch'); ?>
249
  <?php _e('Can use the shortcode in a textwidget and theme files.' , 'newpost-catch'); ?> <a href="http://wordpress.org/plugins/newpost-catch/faq/" target="_blank">FAQ</a>
284
  /** default value **/
285
  extract( shortcode_atts( array(
286
  'id' => "npcatch",
287
+ 'post_type' => "post",
288
  'cat' => NULL,
289
  'width' => 10,
290
  'height' => 10,
315
 
316
  /** query **/
317
  $npc_sc_query = new WP_Query( array(
318
+ 'post_type' => $post_type,
319
  'cat' => $cat,
320
  'offset' => $offset,
321
  'posts_per_page' => $posts_per_page,
languages/newpost-catch-ja.mo CHANGED
Binary file
languages/newpost-catch-ja.po CHANGED
@@ -42,8 +42,13 @@ msgstr "先頭に固定表示している投稿(チェックすると表示)
42
  msgid "Use default css"
43
  msgstr "プラグインフォルダ内のデフォルトCSS(チェックすると適用)"
44
 
 
 
 
45
  msgid "Display category(ies)"
46
- msgstr "特定のカテゴリを指定して表示(ID指定、カンマで複数指定、IDにマイナス値「-」付与で除外 例:1,-2,17 などお好みで)"
 
 
47
 
48
  msgid "Check the category ID"
49
  msgstr "カテゴリのIDを確認"
@@ -55,7 +60,9 @@ msgid "Can use the shortcode in a textwidget and theme files."
55
  msgstr "テーマファイル,投稿本文中など 様々な箇所に表示できます。"
56
 
57
  msgid "Contact/Follow"
58
- msgstr "【専用アカウント作りました】プラグインに関する新機能追加や最新情報などのお知らせを配信します。是非ともフォローください。"
 
 
59
 
60
  msgid "completed."
61
  msgstr "設定完了しました。"
@@ -66,8 +73,13 @@ msgstr "サムネイル設定"
66
  msgid "Eyecatch image batch setting"
67
  msgstr "アイキャッチ画像を一括で設定できます。"
68
 
69
- msgid "I can set the eyecatch image, [the first image] found in the body of the post. (※ image does not exist, invalid image of (dead link) can not be set the URL."
70
- msgstr "投稿の本文内に見つかった「最初の画像」をアイキャッチ画像に設定できます。(※画像が存在しない、URLが無効(リンク切れ)の画像は設定できません。)"
 
 
 
 
 
71
 
72
  msgid "Search the post."
73
  msgstr "投稿を検索"
@@ -78,8 +90,13 @@ msgstr "検索"
78
  msgid "Search Result"
79
  msgstr "検索結果"
80
 
81
- msgid "Can be edited post in the [Edit] button. Please confirm the image displayed in the text and, whether or not broken links."
82
- msgstr "「編集」ボタンで投稿の編集可能です。本文中に画像があるのに「検索結果に表示されない!」という場合は「画像がリンク切れになっていないか」など、ご確認ください。"
 
 
 
 
 
83
 
84
  msgid "Edit"
85
  msgstr "編集"
42
  msgid "Use default css"
43
  msgstr "プラグインフォルダ内のデフォルトCSS(チェックすると適用)"
44
 
45
+ msgid "Post types"
46
+ msgstr "投稿タイプ"
47
+
48
  msgid "Display category(ies)"
49
+ msgstr ""
50
+ "特定のカテゴリを指定して表示(ID指定、カンマで複数指定、IDにマイナス値の付与で"
51
+ "除外 例:1,-2,17 などお好みで)"
52
 
53
  msgid "Check the category ID"
54
  msgstr "カテゴリのIDを確認"
60
  msgstr "テーマファイル,投稿本文中など 様々な箇所に表示できます。"
61
 
62
  msgid "Contact/Follow"
63
+ msgstr ""
64
+ "【専用アカウント作りました】プラグインに関する新機能追加や最新情報などのお知"
65
+ "らせを配信します。是非ともフォローください。"
66
 
67
  msgid "completed."
68
  msgstr "設定完了しました。"
73
  msgid "Eyecatch image batch setting"
74
  msgstr "アイキャッチ画像を一括で設定できます。"
75
 
76
+ msgid ""
77
+ "I can set the eyecatch image, [the first image] found in the body of the "
78
+ "post. (※ image does not exist, invalid image of (dead link) can not be set "
79
+ "the URL."
80
+ msgstr ""
81
+ "投稿の本文内に見つかった「最初の画像」をアイキャッチ画像に設定できます。(※画"
82
+ "像が存在しない、URLが無効(リンク切れ)の画像は設定できません。)"
83
 
84
  msgid "Search the post."
85
  msgstr "投稿を検索"
90
  msgid "Search Result"
91
  msgstr "検索結果"
92
 
93
+ msgid ""
94
+ "Can be edited post in the [Edit] button. Please confirm the image displayed "
95
+ "in the text and, whether or not broken links."
96
+ msgstr ""
97
+ "「編集」ボタンで投稿の編集可能です。本文中に画像があるのに「検索結果に表示さ"
98
+ "れない!」という場合は「画像がリンク切れになっていないか」など、ご確認くださ"
99
+ "い。"
100
 
101
  msgid "Edit"
102
  msgstr "編集"
languages/newpost-catch.pot CHANGED
@@ -65,6 +65,9 @@ msgstr ""
65
  msgid "Eyecatch image batch setting"
66
  msgstr ""
67
 
 
 
 
68
  msgid "I can set the eyecatch image, [the first image] found in the body of the post. (※ image does not exist, invalid image of (dead link) can not be set the URL."
69
  msgstr ""
70
 
65
  msgid "Eyecatch image batch setting"
66
  msgstr ""
67
 
68
+ msgid "Post type"
69
+ msgstr ""
70
+
71
  msgid "I can set the eyecatch image, [the first image] found in the body of the post. (※ image does not exist, invalid image of (dead link) can not be set the URL."
72
  msgstr ""
73
 
newpost-catch.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Newpost Catch
4
  Plugin URI: http://www.imamura.biz/blog/newpost-catch/
5
  Description: Thumbnails in new articles setting widget.
6
- Version: 1.2.2
7
  Author: Tetsuya Imamura
8
  Text Domain: newpost-catch
9
  Author URI: http://www.imamura.biz/blog/
@@ -32,8 +32,6 @@ function npc_options_page() {
32
  require('npc_admin.php');
33
  }
34
 
35
-
36
-
37
  /* Copyright 2012-2014 Tetsuya Imamura (@s56bouya)
38
 
39
  This program is free software; you can redistribute it and/or modify
3
  Plugin Name: Newpost Catch
4
  Plugin URI: http://www.imamura.biz/blog/newpost-catch/
5
  Description: Thumbnails in new articles setting widget.
6
+ Version: 1.2.6
7
  Author: Tetsuya Imamura
8
  Text Domain: newpost-catch
9
  Author URI: http://www.imamura.biz/blog/
32
  require('npc_admin.php');
33
  }
34
 
 
 
35
  /* Copyright 2012-2014 Tetsuya Imamura (@s56bouya)
36
 
37
  This program is free software; you can redistribute it and/or modify
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: s56bouya
3
  Donate link: http://www.imamura.biz/blog/newpost-catch
4
  Tags: widget, plugin, posts, sidebar, image, images, thumb, thumbnail
5
  Requires at least: 3.3.1
6
- Tested up to: 3.8.1
7
- Stable tag: 1.2.2
8
 
9
  Thumbnails in new articles setting widget.
10
 
@@ -62,6 +62,7 @@ Can use the shortcode in a textwidget and theme files.
62
  #### **parameter**
63
 
64
  * **id**(string) - Name of the id attribute "ul" element(default:npcatch)
 
65
  * **cat**(int) - Use category id(default:NULL)
66
  * **width**(int) - Thumbnail width px(default:10)
67
  * **height**(int) - Thumbnail height px(default:10)
@@ -92,6 +93,18 @@ When the post other than, post_type of the current page is the value of the prio
92
 
93
  == Changelog ==
94
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  = 1.2.2 =
96
  * Bugfix(Link to the Setting Thumbnails in the widget).
97
 
3
  Donate link: http://www.imamura.biz/blog/newpost-catch
4
  Tags: widget, plugin, posts, sidebar, image, images, thumb, thumbnail
5
  Requires at least: 3.3.1
6
+ Tested up to: 4.1
7
+ Stable tag: 1.2.6
8
 
9
  Thumbnails in new articles setting widget.
10
 
62
  #### **parameter**
63
 
64
  * **id**(string) - Name of the id attribute "ul" element(default:npcatch)
65
+ * **post_type**(string) - Use post types. Retrieves posts by Post Types(default:post)
66
  * **cat**(int) - Use category id(default:NULL)
67
  * **width**(int) - Thumbnail width px(default:10)
68
  * **height**(int) - Thumbnail height px(default:10)
93
 
94
  == Changelog ==
95
 
96
+ = 1.2.6 =
97
+ * Compatibility check with WP 4.1 and Twenty Fifteen Theme.
98
+
99
+ = 1.2.5 =
100
+ * Use post types. Retrieves posts by Post Types.
101
+
102
+ = 1.2.4 =
103
+ * Compatibility check with WP 4.0.
104
+
105
+ = 1.2.3 =
106
+ * Compatibility check with WP 3.9.
107
+
108
  = 1.2.2 =
109
  * Bugfix(Link to the Setting Thumbnails in the widget).
110