質問編集履歴
2
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,463 +1,11 @@
|
|
1
|
-
|
1
|
+
Meta vix not sure
|
2
2
|
|
3
|
-
|
3
|
+
Ghjbv
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
'Show in Slider' 'ex_show_in_homepage'
|
8
|
-
|
9
|
-
コードをしたら片方の'Show in Slider' が動きます。
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
'ex_show_in_homepage'動かないです。
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
5
|
+
Hhbbn
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
//「投稿」にメタボックスを追加する
|
22
|
-
|
23
|
-
function dess_post_meta_box() {
|
24
6
|
|
25
7
|
|
26
8
|
|
27
9
|
|
28
10
|
|
29
|
-
|
30
|
-
|
31
|
-
add_meta_box(
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
'dess_post_settings',
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
__('Post Settings',''),
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
//_notice_meta_box_callbackに注目してください。メタボックスにフォームフィールドを表示する関数
|
54
|
-
|
55
|
-
'dess_post_meta_box_callback',
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
'post'
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
);
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
}
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
add_action( 'add_meta_boxes', 'dess_post_meta_box' );
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
//「投稿」にメタボックスを追加する add_meta_boxes s 複数形
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
function dess_post_meta_box_callback( $post ) {
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
wp_nonce_field( 'dess_post_save_meta_box_data', 'dess_post_meta_box_nonce' );
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
//slider in slider post id in meta box
|
118
|
-
|
119
|
-
$show_in_slider = get_post_meta( $post->ID, 'show_in_slider', true );
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
//show in homepage post id in meta box
|
124
|
-
|
125
|
-
$show_in_homepage = get_post_meta( $post->ID, 'ex_show_in_homepage', true );
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
//page_featured_type post id
|
130
|
-
|
131
|
-
$type = get_post_meta( $post->ID, 'page_featured_type', true );
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
//投稿編集画面のメタボックスhtml
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
echo '<p><label for="show_in_slider">'.__('Show in Slider','').': </label>';
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
//slider in slider post id from meta box
|
150
|
-
|
151
|
-
echo '<input type="checkbox" id="show_in_slider" name="show_in_slider" value="Yes" '.($show_in_slider == 'Yes' ? 'checked' : '' ).' /></p>';
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
echo '<p><label for="show_in_homepage">Show in Homepage: </label>';
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
//show in homepage post id from meta box
|
164
|
-
|
165
|
-
echo '<input type="checkbox" id="show_in_homepage" name="ex_show_in_homepage" value="Yes" '.($show_in_homepage == 'Yes' ? 'checked' : '' ).' /></p>';
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
echo '<p><label for="video_type">'.__('Featured Type','').': </label><br/>';
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
echo '<select id="video_type" name="dess_post[page_featured_type]"><option value="">Image</option><option value="youtube" '.($type == 'youtube' ? 'selected="selected"' : '').'>Youtube</option><option value="vimeo" '.($type == 'vimeo' ? 'selected="selected"' : '').'>Vimeo</option></select></p>';
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
echo '<p><label for="video_id">'.__('Video ID','').': </label><br/>';
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
echo '<input type="text" id="video_id" name="dess_post[page_video_id]" value="'.get_post_meta( $post->ID, 'page_video_id', true ).'" /></p>';
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
}
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
function dess_post_save_meta_box_data( $post_id ) {
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
if ( ! isset( $_POST['dess_post_meta_box_nonce'] ) ) {
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
return;
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
}
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
if ( ! wp_verify_nonce( $_POST['dess_post_meta_box_nonce'], 'dess_post_save_meta_box_data' ) ) {
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
return;
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
}
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
return;
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
}
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
if ( isset( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) {
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
if ( ! current_user_can( 'edit_page', $post_id ) ) {
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
return;
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
}
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
} else {
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
if ( ! current_user_can( 'edit_post', $post_id ) ) {
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
return;
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
}
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
}
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
$show_in_slider = sanitize_text_field( $_POST['show_in_slider'] );
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
$show_in_slider = sanitize_text_field( $_POST['ex_show_in_homepage'] );
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
update_post_meta( $post_id, 'show_in_slider', $show_in_slider );
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
update_post_meta( $post_id, 'ex_show_in_homepage', $show_in_homepage );
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
$arr = array();
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
if (isset($_POST['dess_post'])){
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
$arr = $_POST['dess_post'];
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
}
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
foreach ($arr as $key => $value) {
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
$val = sanitize_text_field($value);
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
update_post_meta( $post_id, $key, $val );
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
}
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
}
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
//投稿したメタボックスデータを取得、保存
|
462
|
-
|
463
|
-
add_action( 'save_post', 'dess_post_save_meta_box_data' );
|
11
|
+
Hgffhjjhgffghjhhhjkfddddffffffg
|
1
脱字
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
一つのメタボックス利用はできますが、2個目を追加すると表示は
|
2
2
|
|
3
|
-
されますが機能
|
3
|
+
されますが機能しないです。
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
-
|
7
|
+
'Show in Slider' 'ex_show_in_homepage'
|
8
8
|
|
9
9
|
コードをしたら片方の'Show in Slider' が動きます。
|
10
10
|
|