What's New Generator - Version 1.10.0

Version Description

  • NEW!
Download this release

Release Info

Developer hidaka.bizplugin
Plugin Icon wp plugin What's New Generator
Version 1.10.0
Comparing to
See all releases

Code changes from version 1.9.0 to 1.10.0

Files changed (4) hide show
  1. admin-ui.php +7 -1
  2. readme.txt +5 -2
  3. whats-new-generator.php +12 -5
  4. whats-new.css +69 -72
admin-ui.php CHANGED
@@ -19,6 +19,7 @@ class WNGAdminUi {
19
  add_settings_field('wng_orderby', '表示順序', array(&$this,'setting_orderby'), $this->file_path, 'main_section');
20
  add_settings_field('wng_number', '表示件数', array(&$this,'setting_number'), $this->file_path, 'main_section');
21
  add_settings_field('wng_newmark', 'NEW!マーク表示期間', array(&$this,'setting_newmark'), $this->file_path, 'main_section');
 
22
  add_settings_field('wng_dateformat', '日付のフォーマット', array(&$this,'setting_dateformat'), $this->file_path, 'main_section');
23
  add_settings_field('wng_postlist_url', '一覧ページのurl', array(&$this,'setting_postlist_url'), $this->file_path, 'main_section');
24
  }
@@ -85,13 +86,18 @@ class WNGAdminUi {
85
  echo "<input id='wng_newmark' name='whats_new_options[wng_newmark]' size='2' type='text' value='{$value}' />日間";
86
  }
87
 
 
 
 
 
 
 
88
  function setting_category_name() {
89
  $options = WNG::get_option();
90
  $value = $options["wng_category_name"];
91
  echo "<input id='wng_category_name' name='whats_new_options[wng_category_name]' size='40' type='text' value='{$value}' />";
92
  }
93
 
94
-
95
  function setting_number() {
96
  $options = WNG::get_option();
97
  $items = array("3", "5", "7","10", "15", "20");
19
  add_settings_field('wng_orderby', '表示順序', array(&$this,'setting_orderby'), $this->file_path, 'main_section');
20
  add_settings_field('wng_number', '表示件数', array(&$this,'setting_number'), $this->file_path, 'main_section');
21
  add_settings_field('wng_newmark', 'NEW!マーク表示期間', array(&$this,'setting_newmark'), $this->file_path, 'main_section');
22
+ add_settings_field('wng_latest_new', '最新記事にNEW!マークをつける', array(&$this,'setting_latest_new'), $this->file_path, 'main_section');
23
  add_settings_field('wng_dateformat', '日付のフォーマット', array(&$this,'setting_dateformat'), $this->file_path, 'main_section');
24
  add_settings_field('wng_postlist_url', '一覧ページのurl', array(&$this,'setting_postlist_url'), $this->file_path, 'main_section');
25
  }
86
  echo "<input id='wng_newmark' name='whats_new_options[wng_newmark]' size='2' type='text' value='{$value}' />日間";
87
  }
88
 
89
+ function setting_latest_new() {
90
+ $options = WNG::get_option();
91
+ $checked = (isset($options["wng_latest_new"]) && $options["wng_latest_new"]) ? $checked = ' checked="checked" ': "";
92
+ echo "<input id='wng_latest_new' name='whats_new_options[wng_latest_new]' type='checkbox' '{$checked}' />";
93
+ }
94
+
95
  function setting_category_name() {
96
  $options = WNG::get_option();
97
  $value = $options["wng_category_name"];
98
  echo "<input id='wng_category_name' name='whats_new_options[wng_category_name]' size='40' type='text' value='{$value}' />";
99
  }
100
 
 
101
  function setting_number() {
102
  $options = WNG::get_option();
103
  $items = array("3", "5", "7","10", "15", "20");
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: WordPress BizPlugin
3
  Donate link:
4
  Tags: what's new, update Post page
5
  Requires at least: 3.5
6
- Tested up to: 3.7.1
7
- Stable tag: 1.9.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -39,6 +39,9 @@ What’s New Generatorは、投稿、固定ページ、ウィジェットに新
39
 
40
  == Changelog ==
41
 
 
 
 
42
  = 1.9.0 =
43
  * 新着一覧のタイトル文字色を設定する機能追加
44
 
3
  Donate link:
4
  Tags: what's new, update Post page
5
  Requires at least: 3.5
6
+ Tested up to: 3.8.1
7
+ Stable tag: 1.10.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
39
 
40
  == Changelog ==
41
 
42
+ = 1.10.0 =
43
+ * 最新記事にNEW!マークをつける機能追加
44
+
45
  = 1.9.0 =
46
  * 新着一覧のタイトル文字色を設定する機能追加
47
 
whats-new-generator.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: What's New Generator
4
  Plugin URI: http://residentbird.main.jp/bizplugin/
5
  Description: What's New(新着情報)を指定した固定ページや投稿に自動的に表示するプラグインです。
6
- Version: 1.9.0
7
  Author:WordPress Biz Plugin
8
  Author URI: http://residentbird.main.jp/bizplugin/
9
  */
@@ -13,6 +13,7 @@ new WhatsNewPlugin();
13
 
14
  class WNG
15
  {
 
16
  const SHORTCODE = "showwhatsnew";
17
  const OPTIONS = "whats_new_options";
18
 
@@ -28,13 +29,13 @@ class WNG
28
  }
29
 
30
  public static function enqueue_css_js(){
31
- wp_enqueue_style( 'whats-new-style', plugins_url('whats-new.css', __FILE__ ) );
32
  }
33
 
34
  public static function enqueue_admin_css_js(){
35
  wp_enqueue_style( 'wp-color-picker' );
36
- wp_enqueue_style( 'whats-new-style', plugins_url('whats-new.css', __FILE__ ) );
37
- wp_enqueue_script( 'whats-new-admin-js', plugins_url('whats-new-admin.js', __FILE__ ), array( 'wp-color-picker' ), false, true );
38
  }
39
  }
40
 
@@ -70,7 +71,8 @@ class WhatsNewPlugin{
70
  "wng_newmark" => "7",
71
  "wng_postlist_url" => "",
72
  "wng_dateformat" => "Y年n月j日",
73
- "wng_number" => "10"
 
74
  );
75
  WNG::update_option( $arr );
76
  }
@@ -155,6 +157,7 @@ class WhatsNewItem{
155
  var $title;
156
  var $url;
157
  var $newmark;
 
158
 
159
  public function __construct( $post ){
160
  $options = WNG::get_option();
@@ -165,10 +168,14 @@ class WhatsNewItem{
165
  $this->title = esc_html( $post->post_title );
166
  $this->url = get_permalink($post->ID);
167
  $this->newmark = $this->is_new();
 
168
  }
169
 
170
  public function is_new(){
171
  $options = WNG::get_option();
 
 
 
172
  $term = $options['wng_newmark'];
173
  if ( !isset($term) || $term == 0){
174
  return false;
3
  Plugin Name: What's New Generator
4
  Plugin URI: http://residentbird.main.jp/bizplugin/
5
  Description: What's New(新着情報)を指定した固定ページや投稿に自動的に表示するプラグインです。
6
+ Version: 1.10.0
7
  Author:WordPress Biz Plugin
8
  Author URI: http://residentbird.main.jp/bizplugin/
9
  */
13
 
14
  class WNG
15
  {
16
+ const VERSION = "1.10.0";
17
  const SHORTCODE = "showwhatsnew";
18
  const OPTIONS = "whats_new_options";
19
 
29
  }
30
 
31
  public static function enqueue_css_js(){
32
+ wp_enqueue_style( 'whats-new-style', plugins_url('whats-new.css', __FILE__ ), array(), self::VERSION );
33
  }
34
 
35
  public static function enqueue_admin_css_js(){
36
  wp_enqueue_style( 'wp-color-picker' );
37
+ wp_enqueue_style( 'whats-new-style', plugins_url('whats-new.css', __FILE__ ), array(), self::VERSION);
38
+ wp_enqueue_script( 'whats-new-admin-js', plugins_url('whats-new-admin.js', __FILE__ ), array( 'wp-color-picker' ), self::VERSION, true );
39
  }
40
  }
41
 
71
  "wng_newmark" => "7",
72
  "wng_postlist_url" => "",
73
  "wng_dateformat" => "Y年n月j日",
74
+ "wng_number" => "10",
75
+ "wng_latest_new" => false
76
  );
77
  WNG::update_option( $arr );
78
  }
157
  var $title;
158
  var $url;
159
  var $newmark;
160
+ private static $number = 0;
161
 
162
  public function __construct( $post ){
163
  $options = WNG::get_option();
168
  $this->title = esc_html( $post->post_title );
169
  $this->url = get_permalink($post->ID);
170
  $this->newmark = $this->is_new();
171
+ self::$number++;
172
  }
173
 
174
  public function is_new(){
175
  $options = WNG::get_option();
176
+ if ( isset($options['wng_latest_new']) && self::$number == 0){
177
+ return true;
178
+ }
179
  $term = $options['wng_newmark'];
180
  if ( !isset($term) || $term == 0){
181
  return false;
whats-new.css CHANGED
@@ -1,81 +1,78 @@
1
- @CHARSET "UTF-8";
2
-
3
- .whatsnew {
4
- margin:10px 0;
5
- border-radius: 3px; /* CSS3 */
6
- -webkit-border-radius: 3px; /* Safari,Google Chrome */
7
- -moz-border-radius: 3px; /* Firefox */
8
- border: 1px Silver solid;
9
- font-size: 100%;
10
- word-break:break-all;
11
- overflow: hidden;
12
  }
13
 
14
- .wn-head {
15
- margin: 0;
16
- padding: 5px 10px;
17
- box-shadow: 1px 1px 4px #ccc;
18
- -webkit-box-shadow: 1px 1px 4px #ccc;
19
- -moz-box-shadow: 1px 1px 4px #ccc;
20
- border: 0;
21
- border-bottom: 1px Silver solid;
22
- border-top-left-radius: 3px; /* 左上 */
23
- border-top-right-radius: 3px; /* 右上 */
24
- -webkit-border-top-left-radius: 3px; /* 左上 */
25
- -webkit-border-top-right-radius: 3px; /* 右上 */
26
- -moz-border-radius-topleft: 3px; /* 左上 */
27
- -moz-border-radius-topright: 3px; /* 右上 */
28
- overflow: hidden;
29
  }
30
-
31
- .wn-title {
32
- font-weight: bold;
33
- font-size: 100%;
34
- text-align: left;
35
- float:left;
36
  }
37
-
38
- .wn-postlist {
39
- background: transparent url('./image/list.png') left center no-repeat;
40
- padding-left:1.3em;
41
- font-weight: normal;
42
- font-size: 90%;
43
- text-align: right;
44
- cursor: pointer;
45
- float:right;
46
  }
47
 
48
- .wn-item {
49
- margin: 5px 0;
50
- padding: 0;
51
- border: 0;
52
- overflow: hidden;
53
  }
54
-
55
-
56
- .wn-date {
57
- margin: 0 0 0 0.3em;
58
- padding: 0;
59
- border: 0;
60
- float: left;
61
- width: 8.7em;
62
- font-weight: normal;
63
- overflow: hidden;
64
  }
65
-
66
- .wn-article {
67
- margin: 0;
68
- padding: 0 2px;
69
- overflow: hidden;
 
 
 
 
 
 
 
 
 
 
 
70
  }
71
-
72
- .newmark {
73
- font-size: 74%;
74
- vertical-align:middle;
75
- color: White;
76
- background-color: #ff4500;
77
- padding: 1px 5px;
78
- border-radius: 3px; /* CSS3 */
79
- -webkit-border-radius: 3px; /* Safari,Google Chrome */
80
- -moz-border-radius: 3px; /* Firefox */
81
- }
1
+ div.whatsnew {
2
+ margin: 10px 0;
3
+ font-size: 100%;
4
+ word-break: break-all;
5
+ overflow: hidden;
6
+ border: 1px silver solid;
7
+ -webkit-border-radius: 3px;
8
+ -moz-border-radius: 3px;
9
+ -ms-border-radius: 3px;
10
+ -o-border-radius: 3px;
11
+ border-radius: 3px;
12
  }
13
 
14
+ div.wn-head {
15
+ margin: 0;
16
+ padding: 5px 10px;
17
+ overflow: hidden;
18
+ border: 0;
19
+ border-bottom: 1px silver solid;
20
+ -webkit-box-shadow: #cccccc 1px 1px 4px;
21
+ -moz-box-shadow: #cccccc 1px 1px 4px;
22
+ box-shadow: #cccccc 1px 1px 4px;
23
+ -moz-border-radius-topleft: 3px;
24
+ -webkit-border-top-left-radius: 3px;
25
+ border-top-left-radius: 3px;
26
+ -moz-border-radius-topright: 3px;
27
+ -webkit-border-top-right-radius: 3px;
28
+ border-top-right-radius: 3px;
29
  }
30
+ div.wn-head .wn-title {
31
+ font-weight: bold;
32
+ font-size: 100%;
33
+ text-align: left;
34
+ float: left;
35
+ overflow: hidden;
36
  }
37
+ div.wn-head .wn-postlist {
38
+ background: transparent url("./image/list.png") left center no-repeat;
39
+ padding-left: 1.3em;
40
+ font-weight: normal;
41
+ font-size: 90%;
42
+ text-align: right;
43
+ cursor: pointer;
44
+ float: right;
 
45
  }
46
 
47
+ div.wn-item {
48
+ margin: 5px 0;
49
+ padding: 0;
50
+ border: 0;
51
+ overflow: hidden;
52
  }
53
+ div.wn-item .wn-date {
54
+ margin: 0 0 0 0.3em;
55
+ padding: 0;
56
+ border: 0;
57
+ float: left;
58
+ width: 8.7em;
59
+ font-weight: normal;
60
+ overflow: hidden;
 
 
61
  }
62
+ div.wn-item .wn-article {
63
+ margin: 0;
64
+ padding: 0 2px;
65
+ overflow: hidden;
66
+ }
67
+ div.wn-item .wn-article .newmark {
68
+ font-size: 74%;
69
+ padding: 1px 5px;
70
+ vertical-align: middle;
71
+ color: White;
72
+ background-color: #ff4500;
73
+ -webkit-border-radius: 3px;
74
+ -moz-border-radius: 3px;
75
+ -ms-border-radius: 3px;
76
+ -o-border-radius: 3px;
77
+ border-radius: 3px;
78
  }