11
11
"sites_link " => array (
12
12
"name " => "_sites_link " ,
13
13
"std " => "" ,
14
- "title " => "输入网址链接,需包含 http(s):// " ,
14
+ "title " => "输入网址链接,需包含 http(s)://<br><span style='font-weight: normal;color: crimson;margin-top: 10px;display: block;'>注意:“网址”和“公众号二维码”两者可同时填写,但是至少填一项。</span> " ,
15
15
"type " =>"text " ),
16
16
17
17
"sites_sescribe " => array (
@@ -48,7 +48,7 @@ function new_meta_sites_boxes() {
48
48
global $ post , $ new_meta_sites_boxes ;
49
49
//获取保存
50
50
foreach ($ new_meta_sites_boxes as $ meta_box ) {
51
- $ meta_box_value = get_post_meta ($ post ->ID , $ meta_box ['name ' ] . '' , true );
51
+ $ meta_box_value = get_post_meta ($ post ->ID , $ meta_box ['name ' ] , true );
52
52
if ($ meta_box_value != "" )
53
53
//将默认值替换为已保存的值
54
54
$ meta_box ['std ' ] = $ meta_box_value ;
@@ -59,15 +59,15 @@ function new_meta_sites_boxes() {
59
59
echo '<h4> ' . $ meta_box ['title ' ] . '</h4> ' ;
60
60
break ;
61
61
case 'text ' :
62
- echo '<h4> ' . $ meta_box ['title ' ] . '</h4> ' ;
62
+ echo '<h4 style="margin-bottom: 0;" > ' . $ meta_box ['title ' ] . '</h4> ' ;
63
63
echo '<span class="form-field"><input type="text" size="40" name=" ' . $ meta_box ['name ' ] . '" value=" ' . $ meta_box ['std ' ] . '" /></span><br /> ' ;
64
64
break ;
65
65
case 'textarea ' :
66
- echo '<h4> ' . $ meta_box ['title ' ] . '</h4> ' ;
66
+ echo '<h4 style="margin-bottom: 0;" > ' . $ meta_box ['title ' ] . '</h4> ' ;
67
67
echo '<textarea id="seo-excerpt" cols="40" rows="2" name=" ' . $ meta_box ['name ' ] . '"> ' . $ meta_box ['std ' ] . '</textarea><br /> ' ;
68
68
break ;
69
69
case 'radio ' :
70
- echo '<h4> ' . $ meta_box ['title ' ] . '</h4> ' ;
70
+ echo '<h4 style="margin-bottom: 0;" > ' . $ meta_box ['title ' ] . '</h4> ' ;
71
71
$ counter = 1 ;
72
72
foreach ($ meta_box ['buttons ' ] as $ radiobutton ) {
73
73
$ checked = "" ;
@@ -86,9 +86,8 @@ function new_meta_sites_boxes() {
86
86
break ;
87
87
case 'upload ' :
88
88
$ button_text = (isset ($ meta_box ['button_text ' ])) ? $ meta_box ['button_text ' ] : 'Upload ' ;
89
- echo '<h4> ' . $ meta_box ['title ' ] . '</h4> ' ;
89
+ echo '<h4 style="margin-bottom: 0;" > ' . $ meta_box ['title ' ] . '</h4> ' ;
90
90
echo '<input class="damiwp_url_input" style="width: 95%;margin-bottom: 10px;" type="text" id=" ' .$ meta_box ['name ' ].'_input" size=" ' .$ meta_box ['size ' ].'" value=" ' .$ meta_box ['std ' ].'" name=" ' .$ meta_box ['name ' ].'"/><br><a href="#" id=" ' .$ meta_box ['name ' ].'" class="dami_upload_button button"> ' .$ button_text .'</a> ' ;
91
- //add_script_and_styles();
92
91
break ;
93
92
}
94
93
}
@@ -102,18 +101,18 @@ function create_meta_sites_box() {
102
101
function save_sites_postdata ($ post_id ) {
103
102
global $ post , $ new_meta_sites_boxes ;
104
103
foreach ($ new_meta_sites_boxes as $ meta_box ) {
105
- if (!wp_verify_nonce ($ _POST [$ meta_box ['name ' ] . '_noncename ' ], plugin_basename (__FILE__ ))) {
104
+ if (!wp_verify_nonce ((@ $ _POST [$ meta_box ['name ' ] . '_noncename ' ]) , plugin_basename (__FILE__ ))) {
106
105
return $ post_id ;
107
106
}
108
107
if ('page ' == $ _POST ['post_type ' ]) {
109
108
if (!current_user_can ('edit_page ' , $ post_id )) return $ post_id ;
110
109
} else {
111
110
if (!current_user_can ('edit_post ' , $ post_id )) return $ post_id ;
112
111
}
113
- $ data = $ _POST [$ meta_box ['name ' ] . '' ];
114
- if (get_post_meta ($ post_id , $ meta_box ['name ' ] . '' ) == "" ) add_post_meta ($ post_id , $ meta_box ['name ' ] . '' , $ data , true );
115
- elseif ($ data != get_post_meta ($ post_id , $ meta_box ['name ' ] . '' , true )) update_post_meta ($ post_id , $ meta_box ['name ' ] . '' , $ data );
116
- elseif ($ data == "" ) delete_post_meta ($ post_id , $ meta_box ['name ' ] . '' , get_post_meta ($ post_id , $ meta_box ['name ' ] . '' , true ));
112
+ $ data = $ _POST [$ meta_box ['name ' ] ];
113
+ if (get_post_meta ($ post_id , $ meta_box ['name ' ] ) == "" ) add_post_meta ($ post_id , $ meta_box ['name ' ] , $ data , true );
114
+ elseif ($ data != get_post_meta ($ post_id , $ meta_box ['name ' ] , true )) update_post_meta ($ post_id , $ meta_box ['name ' ] , $ data );
115
+ elseif ($ data == "" ) delete_post_meta ($ post_id , $ meta_box ['name ' ] , get_post_meta ($ post_id , $ meta_box ['name ' ] , true ));
117
116
}
118
117
}
119
118
add_action ('admin_menu ' , 'create_meta_sites_box ' );
0 commit comments