Version Description
- Added NEW! mark
Download this release
Release Info
Developer | hidaka.bizplugin |
Plugin | What's New Generator |
Version | 1.4.0 |
Comparing to | |
See all releases |
Code changes from version 1.3.0 to 1.4.0
- readme.txt +44 -5
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- whats-new-generator.php +44 -9
- whats-new.css +14 -2
- whatsnew-view.php +5 -2
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: WordPress BizPlugin
|
|
3 |
Donate link:
|
4 |
Tags: what's new, update
|
5 |
Requires at least: 3.4
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -20,13 +20,38 @@ This plug-in creates the latest information of your site in the page by shortcod
|
|
20 |
* Select the number of what's new items
|
21 |
* Preview what's new on admin page
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
== Installation ==
|
24 |
|
25 |
-
1. Upload `plugin-name.
|
26 |
1. Activate the plugin through the 'Plugins' menu in WordPress
|
27 |
|
|
|
|
|
|
|
|
|
|
|
28 |
== Changelog ==
|
29 |
|
|
|
|
|
|
|
30 |
= 1.3.0 =
|
31 |
* Added filter fook for widget
|
32 |
|
@@ -40,5 +65,19 @@ This plug-in creates the latest information of your site in the page by shortcod
|
|
40 |
= 1.0.0 =
|
41 |
* First release.
|
42 |
|
43 |
-
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
Donate link:
|
4 |
Tags: what's new, update
|
5 |
Requires at least: 3.4
|
6 |
+
Tested up to: 3.5
|
7 |
+
Stable tag: 1.4.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
20 |
* Select the number of what's new items
|
21 |
* Preview what's new on admin page
|
22 |
|
23 |
+
###日本語版
|
24 |
+
|
25 |
+
What’s New Generatorは、投稿、固定ページ、ウィジェットに新着情報を表示するプラグインです。
|
26 |
+
|
27 |
+
新着情報の日付、タイトルは自動的に表示されます。また、タイトルをクリックすると該当のページが開きます。
|
28 |
+
|
29 |
+
= 特徴 =
|
30 |
+
|
31 |
+
* 期間を指定してタイトルにNEW!マークを表示させることができます。
|
32 |
+
* 新着情報に表示するコンテンツに投稿または固定ページを設定できます。
|
33 |
+
* 表示する件数を設定できます。
|
34 |
+
* 表示順序は、公開日順・更新日順から選択できます。
|
35 |
+
* カテゴリを指定して記事の新着情報を表示させることができます。(投稿のみ)
|
36 |
+
* WordPressの設定画面でこれらの設定を行い、新着表示のプレビューができます。
|
37 |
+
|
38 |
+
詳細な使用方法はこちらです: http://residentbird.main.jp/bizplugin/plugins/whats-new-generator/
|
39 |
+
|
40 |
== Installation ==
|
41 |
|
42 |
+
1. Upload `plugin-name.zip` to the `/wp-content/plugins/` directory
|
43 |
1. Activate the plugin through the 'Plugins' menu in WordPress
|
44 |
|
45 |
+
== Screenshots ==
|
46 |
+
|
47 |
+
1. Latest information
|
48 |
+
2. Admin page
|
49 |
+
|
50 |
== Changelog ==
|
51 |
|
52 |
+
= 1.4.0 =
|
53 |
+
* Added NEW! mark
|
54 |
+
|
55 |
= 1.3.0 =
|
56 |
* Added filter fook for widget
|
57 |
|
65 |
= 1.0.0 =
|
66 |
* First release.
|
67 |
|
68 |
+
###日本語版
|
69 |
+
= 1.4.0 =
|
70 |
+
* NEWマーク表示機能追加
|
71 |
+
|
72 |
+
= 1.3.0 =
|
73 |
+
* ウィジェットへの新着一覧表示に対応しました
|
74 |
+
|
75 |
+
= 1.2.0 =
|
76 |
+
* 新着一覧のタイトル背景色を設定する機能追加
|
77 |
+
|
78 |
+
= 1.1.0 =
|
79 |
+
* 新着一覧に表示するカテゴリを設定する機能追加
|
80 |
+
* 新着一覧のデザイン変更
|
81 |
+
|
82 |
+
= 1.0.0 =
|
83 |
+
* 初版リリース
|
screenshot-1.png
ADDED
Binary file
|
screenshot-2.png
ADDED
Binary file
|
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.
|
7 |
Author:WordPress Biz Plugin
|
8 |
Author URI: http://residentbird.main.jp/bizplugin/
|
9 |
*/
|
@@ -62,6 +62,7 @@ class WhatsNewPlugin{
|
|
62 |
"wng_category_chk" => "",
|
63 |
"wng_category_name" => "",
|
64 |
"wng_background_color" => "#f5f5f5",
|
|
|
65 |
"wng_number" => "10"
|
66 |
);
|
67 |
update_option($this->option_name, $arr);
|
@@ -69,7 +70,7 @@ class WhatsNewPlugin{
|
|
69 |
}
|
70 |
|
71 |
function on_admin_init() {
|
72 |
-
register_setting($this->option_name, $this->option_name);
|
73 |
add_settings_section('main_section', '表示設定', array(&$this,'section_text_fn'), __FILE__);
|
74 |
add_settings_field('wng_title', 'タイトル', array(&$this,'setting_title'), __FILE__, 'main_section');
|
75 |
add_settings_field('wng_background_color', 'タイトル背景色', array(&$this,'setting_background_color'), __FILE__, 'main_section');
|
@@ -78,9 +79,19 @@ class WhatsNewPlugin{
|
|
78 |
add_settings_field('wng_category_name', ' カテゴリーのスラッグ', array(&$this,'setting_category_name'), __FILE__, 'main_section');
|
79 |
add_settings_field('wng_orderby', '表示順序', array(&$this,'setting_orderby'), __FILE__, 'main_section');
|
80 |
add_settings_field('wng_number', '表示件数', array(&$this,'setting_number'), __FILE__, 'main_section');
|
|
|
81 |
wp_register_style( 'whats-new-style', plugins_url('whats-new.css', __FILE__) );
|
82 |
}
|
83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
|
85 |
public function on_admin_menu() {
|
86 |
$page = add_options_page("What's New 設定", "What's New 設定", 'administrator', __FILE__, array(&$this, 'show_admin_page'));
|
@@ -126,6 +137,12 @@ class WhatsNewPlugin{
|
|
126 |
echo "<input id='wng_background_color' name='whats_new_options[wng_background_color]' size='10' type='text' value='{$value}' />";
|
127 |
}
|
128 |
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
|
130 |
function setting_category_chk() {
|
131 |
$id = "wng_category_chk";
|
@@ -147,7 +164,7 @@ class WhatsNewPlugin{
|
|
147 |
// DROP-DOWN-BOX - Name: whats_new_options[dropdown1]
|
148 |
function setting_number() {
|
149 |
$options = get_option($this->option_name);
|
150 |
-
$items = array("5", "10", "15", "20");
|
151 |
echo "<select id='wng_number' name='whats_new_options[wng_number]'>";
|
152 |
foreach($items as $item) {
|
153 |
$selected = ($options['wng_number']==$item) ? 'selected="selected"' : '';
|
@@ -199,10 +216,10 @@ class WhatsNewInfo{
|
|
199 |
$this->category_chk = isset($options['wng_category_chk']) ? $options['wng_category_chk'] : "";
|
200 |
$this->category_name = $options['wng_category_name'];
|
201 |
$this->background_color = $options['wng_background_color'];
|
202 |
-
$this->createWhatsNewItems();
|
203 |
}
|
204 |
|
205 |
-
private function createWhatsNewItems(){
|
206 |
$condition = array();
|
207 |
$condition['post_type'] = $this->content_type == '投稿' ? 'post' : 'page';
|
208 |
$condition['numberposts'] = $this->num;
|
@@ -217,7 +234,7 @@ class WhatsNewInfo{
|
|
217 |
return;
|
218 |
}
|
219 |
foreach($posts as $post){
|
220 |
-
$this->items[] = new WhatsNewItem($post, $this->orderby);
|
221 |
}
|
222 |
}
|
223 |
}
|
@@ -228,14 +245,32 @@ class WhatsNewInfo{
|
|
228 |
*/
|
229 |
class WhatsNewItem{
|
230 |
var $date;
|
|
|
231 |
var $title;
|
232 |
var $url;
|
|
|
233 |
|
234 |
-
public function __construct( $post, $orderby ){
|
235 |
-
$this->
|
236 |
-
$this->date = date("Y年n月j日", strtotime($this->
|
237 |
$this->title = esc_html( $post->post_title );
|
238 |
$this->url = get_permalink($post->ID);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
}
|
240 |
}
|
241 |
?>
|
3 |
Plugin Name: What's New Generator
|
4 |
Plugin URI: http://residentbird.main.jp/bizplugin/
|
5 |
Description: What's New(新着情報)を指定した固定ページや投稿に自動的に表示するプラグインです。
|
6 |
+
Version: 1.4.0
|
7 |
Author:WordPress Biz Plugin
|
8 |
Author URI: http://residentbird.main.jp/bizplugin/
|
9 |
*/
|
62 |
"wng_category_chk" => "",
|
63 |
"wng_category_name" => "",
|
64 |
"wng_background_color" => "#f5f5f5",
|
65 |
+
"wng_newmark" => "7",
|
66 |
"wng_number" => "10"
|
67 |
);
|
68 |
update_option($this->option_name, $arr);
|
70 |
}
|
71 |
|
72 |
function on_admin_init() {
|
73 |
+
register_setting($this->option_name, $this->option_name, array ( &$this, 'validate' ));
|
74 |
add_settings_section('main_section', '表示設定', array(&$this,'section_text_fn'), __FILE__);
|
75 |
add_settings_field('wng_title', 'タイトル', array(&$this,'setting_title'), __FILE__, 'main_section');
|
76 |
add_settings_field('wng_background_color', 'タイトル背景色', array(&$this,'setting_background_color'), __FILE__, 'main_section');
|
79 |
add_settings_field('wng_category_name', ' カテゴリーのスラッグ', array(&$this,'setting_category_name'), __FILE__, 'main_section');
|
80 |
add_settings_field('wng_orderby', '表示順序', array(&$this,'setting_orderby'), __FILE__, 'main_section');
|
81 |
add_settings_field('wng_number', '表示件数', array(&$this,'setting_number'), __FILE__, 'main_section');
|
82 |
+
add_settings_field('wng_newmark', 'NEW!マーク表示期間', array(&$this,'setting_newmark'), __FILE__, 'main_section');
|
83 |
wp_register_style( 'whats-new-style', plugins_url('whats-new.css', __FILE__) );
|
84 |
}
|
85 |
|
86 |
+
function validate($input) {
|
87 |
+
if ( !is_numeric( $input['wng_newmark']) || $input['wng_newmark'] < 0){
|
88 |
+
$input['wng_newmark'] = 0;
|
89 |
+
}
|
90 |
+
if ($input['wng_newmark'] > 30 ){
|
91 |
+
$input['wng_newmark'] = 30;
|
92 |
+
}
|
93 |
+
return $input; // return validated input
|
94 |
+
}
|
95 |
|
96 |
public function on_admin_menu() {
|
97 |
$page = add_options_page("What's New 設定", "What's New 設定", 'administrator', __FILE__, array(&$this, 'show_admin_page'));
|
137 |
echo "<input id='wng_background_color' name='whats_new_options[wng_background_color]' size='10' type='text' value='{$value}' />";
|
138 |
}
|
139 |
|
140 |
+
function setting_newmark() {
|
141 |
+
$options = get_option($this->option_name);
|
142 |
+
$value = esc_html( $options["wng_newmark"] );
|
143 |
+
echo "<input id='wng_newmark' name='whats_new_options[wng_newmark]' size='4' type='text' value='{$value}' />";
|
144 |
+
}
|
145 |
+
|
146 |
|
147 |
function setting_category_chk() {
|
148 |
$id = "wng_category_chk";
|
164 |
// DROP-DOWN-BOX - Name: whats_new_options[dropdown1]
|
165 |
function setting_number() {
|
166 |
$options = get_option($this->option_name);
|
167 |
+
$items = array("3", "5", "7","10", "15", "20");
|
168 |
echo "<select id='wng_number' name='whats_new_options[wng_number]'>";
|
169 |
foreach($items as $item) {
|
170 |
$selected = ($options['wng_number']==$item) ? 'selected="selected"' : '';
|
216 |
$this->category_chk = isset($options['wng_category_chk']) ? $options['wng_category_chk'] : "";
|
217 |
$this->category_name = $options['wng_category_name'];
|
218 |
$this->background_color = $options['wng_background_color'];
|
219 |
+
$this->createWhatsNewItems( $option_name );
|
220 |
}
|
221 |
|
222 |
+
private function createWhatsNewItems($option_name){
|
223 |
$condition = array();
|
224 |
$condition['post_type'] = $this->content_type == '投稿' ? 'post' : 'page';
|
225 |
$condition['numberposts'] = $this->num;
|
234 |
return;
|
235 |
}
|
236 |
foreach($posts as $post){
|
237 |
+
$this->items[] = new WhatsNewItem($post, $this->orderby ,$option_name );
|
238 |
}
|
239 |
}
|
240 |
}
|
245 |
*/
|
246 |
class WhatsNewItem{
|
247 |
var $date;
|
248 |
+
var $raw_date;
|
249 |
var $title;
|
250 |
var $url;
|
251 |
+
var $newmark;
|
252 |
|
253 |
+
public function __construct( $post, $orderby, $option_name ){
|
254 |
+
$this->raw_date = $orderby == '公開日順' ? $post->post_date : $post->post_modified;
|
255 |
+
$this->date = date("Y年n月j日", strtotime($this->raw_date));
|
256 |
$this->title = esc_html( $post->post_title );
|
257 |
$this->url = get_permalink($post->ID);
|
258 |
+
$this->newmark = $this->is_new( $option_name );
|
259 |
+
}
|
260 |
+
|
261 |
+
public function is_new( $option_name ){
|
262 |
+
$options = get_option($option_name);
|
263 |
+
$term = $options['wng_newmark'];
|
264 |
+
if ( !isset($term) || $term == 0){
|
265 |
+
return false;
|
266 |
+
}
|
267 |
+
$today = date_i18n('U');
|
268 |
+
$post_date = date('U', strtotime($this->raw_date));
|
269 |
+
$diff = ( $today - $post_date ) / ( 24 * 60 * 60 );
|
270 |
+
if ($term > $diff){
|
271 |
+
return true;
|
272 |
+
}
|
273 |
+
return false;
|
274 |
}
|
275 |
}
|
276 |
?>
|
whats-new.css
CHANGED
@@ -10,7 +10,9 @@ div.whatsnew {
|
|
10 |
font-size: 100%;
|
11 |
}
|
12 |
|
13 |
-
|
|
|
|
|
14 |
margin: 0;
|
15 |
padding: 5px 10px;
|
16 |
background-color: WhiteSmoke;
|
@@ -25,7 +27,6 @@ div.whatsnew h2 {
|
|
25 |
-webkit-border-top-right-radius: 5px; /* 右上 */
|
26 |
-moz-border-radius-topleft: 5px; /* 左上 */
|
27 |
-moz-border-radius-topright: 5px; /* 右上 */
|
28 |
-
font-size: 100%;
|
29 |
}
|
30 |
|
31 |
div.whatsnew dl {
|
@@ -46,4 +47,15 @@ div.whatsnew dt {
|
|
46 |
div.whatsnew dd {
|
47 |
margin: 0;
|
48 |
padding: 0 0 0 9em;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
}
|
10 |
font-size: 100%;
|
11 |
}
|
12 |
|
13 |
+
p.whatsnewtitle {
|
14 |
+
font-weight: bold;
|
15 |
+
font-size: 110%;
|
16 |
margin: 0;
|
17 |
padding: 5px 10px;
|
18 |
background-color: WhiteSmoke;
|
27 |
-webkit-border-top-right-radius: 5px; /* 右上 */
|
28 |
-moz-border-radius-topleft: 5px; /* 左上 */
|
29 |
-moz-border-radius-topright: 5px; /* 右上 */
|
|
|
30 |
}
|
31 |
|
32 |
div.whatsnew dl {
|
47 |
div.whatsnew dd {
|
48 |
margin: 0;
|
49 |
padding: 0 0 0 9em;
|
50 |
+
}
|
51 |
+
|
52 |
+
.newmark {
|
53 |
+
font-size: 74%;
|
54 |
+
vertical-align:middle;
|
55 |
+
color: White;
|
56 |
+
background-color: #ff4500;
|
57 |
+
padding: 1px 5px;
|
58 |
+
border-radius: 3px; /* CSS3 */
|
59 |
+
-webkit-border-radius: 3px; /* Safari,Google Chrome */
|
60 |
+
-moz-border-radius: 3px; /* Firefox */
|
61 |
}
|
whatsnew-view.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
<div class='whatsnew'>
|
2 |
-
<
|
3 |
<?php if (!empty($info->background_color)){
|
4 |
echo "style='background-color: {$info->background_color};'";
|
5 |
}?>>
|
6 |
<?php echo $info->title; ?>
|
7 |
-
</
|
8 |
|
9 |
<dl>
|
10 |
<?php foreach($info->items as $item): ?>
|
@@ -12,6 +12,9 @@
|
|
12 |
<?php echo $item->date; ?>
|
13 |
</dt>
|
14 |
<dd>
|
|
|
|
|
|
|
15 |
<a href="<?php echo $item->url; ?>"><?php echo $item->title; ?> </a>
|
16 |
</dd>
|
17 |
<?php endforeach; ?>
|
1 |
<div class='whatsnew'>
|
2 |
+
<p class='whatsnewtitle'
|
3 |
<?php if (!empty($info->background_color)){
|
4 |
echo "style='background-color: {$info->background_color};'";
|
5 |
}?>>
|
6 |
<?php echo $info->title; ?>
|
7 |
+
</p>
|
8 |
|
9 |
<dl>
|
10 |
<?php foreach($info->items as $item): ?>
|
12 |
<?php echo $item->date; ?>
|
13 |
</dt>
|
14 |
<dd>
|
15 |
+
<?php if ( $item->newmark ): ?>
|
16 |
+
<span class='newmark' >NEW!</span>
|
17 |
+
<?php endif; ?>
|
18 |
<a href="<?php echo $item->url; ?>"><?php echo $item->title; ?> </a>
|
19 |
</dd>
|
20 |
<?php endforeach; ?>
|