author | ymh <ymh.work@gmail.com> |
Tue, 15 Dec 2020 13:49:49 +0100 | |
changeset 16 | a86126ab1dd4 |
parent 9 | 177826044cd9 |
child 18 | be944660c56a |
permissions | -rw-r--r-- |
0 | 1 |
<?php |
16 | 2 |
/** |
3 |
* WordPress Administration Meta Boxes API. |
|
4 |
* |
|
5 |
* @package WordPress |
|
6 |
* @subpackage Administration |
|
7 |
*/ |
|
0 | 8 |
|
16 | 9 |
// |
10 |
// Post-related Meta Boxes. |
|
11 |
// |
|
0 | 12 |
|
13 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
14 |
* Displays post submit form fields. |
0 | 15 |
* |
16 |
* @since 2.7.0 |
|
17 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
18 |
* @global string $action |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
19 |
* |
16 | 20 |
* @param WP_Post $post Current post object. |
21 |
* @param array $args { |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
22 |
* Array of arguments for building the post submit meta box. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
23 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
24 |
* @type string $id Meta box 'id' attribute. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
25 |
* @type string $title Meta box title. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
26 |
* @type callable $callback Meta box display callback. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
27 |
* @type array $args Extra meta box arguments. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
28 |
* } |
0 | 29 |
*/ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
30 |
function post_submit_meta_box( $post, $args = array() ) { |
0 | 31 |
global $action; |
32 |
||
16 | 33 |
$post_id = (int) $post->ID; |
9 | 34 |
$post_type = $post->post_type; |
35 |
$post_type_object = get_post_type_object( $post_type ); |
|
36 |
$can_publish = current_user_can( $post_type_object->cap->publish_posts ); |
|
37 |
?> |
|
0 | 38 |
<div class="submitbox" id="submitpost"> |
39 |
||
40 |
<div id="minor-publishing"> |
|
41 |
||
16 | 42 |
<?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key. ?> |
43 |
<div style="display:none;"> |
|
44 |
<?php submit_button( __( 'Save' ), '', 'save' ); ?> |
|
45 |
</div> |
|
46 |
||
47 |
<div id="minor-publishing-actions"> |
|
48 |
<div id="save-action"> |
|
49 |
<?php |
|
50 |
if ( ! in_array( $post->post_status, array( 'publish', 'future', 'pending' ), true ) ) { |
|
51 |
$private_style = ''; |
|
52 |
if ( 'private' === $post->post_status ) { |
|
53 |
$private_style = 'style="display:none"'; |
|
54 |
} |
|
55 |
?> |
|
56 |
<input <?php echo $private_style; ?> type="submit" name="save" id="save-post" value="<?php esc_attr_e( 'Save Draft' ); ?>" class="button" /> |
|
57 |
<span class="spinner"></span> |
|
58 |
<?php } elseif ( 'pending' === $post->post_status && $can_publish ) { ?> |
|
59 |
<input type="submit" name="save" id="save-post" value="<?php esc_attr_e( 'Save as Pending' ); ?>" class="button" /> |
|
60 |
<span class="spinner"></span> |
|
61 |
<?php } ?> |
|
62 |
</div> |
|
0 | 63 |
|
9 | 64 |
<?php |
16 | 65 |
if ( is_post_type_viewable( $post_type_object ) ) : |
66 |
?> |
|
67 |
<div id="preview-action"> |
|
68 |
<?php |
|
69 |
$preview_link = esc_url( get_preview_post_link( $post ) ); |
|
70 |
if ( 'publish' === $post->post_status ) { |
|
71 |
$preview_button_text = __( 'Preview Changes' ); |
|
72 |
} else { |
|
73 |
$preview_button_text = __( 'Preview' ); |
|
74 |
} |
|
5 | 75 |
|
16 | 76 |
$preview_button = sprintf( |
77 |
'%1$s<span class="screen-reader-text"> %2$s</span>', |
|
78 |
$preview_button_text, |
|
79 |
/* translators: Accessibility text. */ |
|
80 |
__( '(opens in a new tab)' ) |
|
81 |
); |
|
82 |
?> |
|
83 |
<a class="preview button" href="<?php echo $preview_link; ?>" target="wp-preview-<?php echo $post_id; ?>" id="post-preview"><?php echo $preview_button; ?></a> |
|
84 |
<input type="hidden" name="wp-preview" id="wp-preview" value="" /> |
|
85 |
</div> |
|
86 |
<?php |
|
87 |
endif; |
|
88 |
||
89 |
/** |
|
90 |
* Fires before the post time/date setting in the Publish meta box. |
|
91 |
* |
|
92 |
* @since 4.4.0 |
|
93 |
* |
|
94 |
* @param WP_Post $post WP_Post object for the current post. |
|
95 |
*/ |
|
96 |
do_action( 'post_submitbox_minor_actions', $post ); |
|
9 | 97 |
?> |
16 | 98 |
<div class="clear"></div> |
99 |
</div> |
|
0 | 100 |
|
16 | 101 |
<div id="misc-publishing-actions"> |
102 |
<div class="misc-pub-section misc-pub-post-status"> |
|
103 |
<?php _e( 'Status:' ); ?> |
|
104 |
<span id="post-status-display"> |
|
105 |
<?php |
|
106 |
switch ( $post->post_status ) { |
|
107 |
case 'private': |
|
108 |
_e( 'Privately Published' ); |
|
109 |
break; |
|
110 |
case 'publish': |
|
111 |
_e( 'Published' ); |
|
112 |
break; |
|
113 |
case 'future': |
|
114 |
_e( 'Scheduled' ); |
|
115 |
break; |
|
116 |
case 'pending': |
|
117 |
_e( 'Pending Review' ); |
|
118 |
break; |
|
119 |
case 'draft': |
|
120 |
case 'auto-draft': |
|
121 |
_e( 'Draft' ); |
|
122 |
break; |
|
123 |
} |
|
124 |
?> |
|
125 |
</span> |
|
0 | 126 |
|
9 | 127 |
<?php |
16 | 128 |
if ( 'publish' === $post->post_status || 'private' === $post->post_status || $can_publish ) { |
129 |
$private_style = ''; |
|
130 |
if ( 'private' === $post->post_status ) { |
|
131 |
$private_style = 'style="display:none"'; |
|
132 |
} |
|
133 |
?> |
|
134 |
<a href="#post_status" <?php echo $private_style; ?> class="edit-post-status hide-if-no-js" role="button"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit status' ); ?></span></a> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
135 |
|
16 | 136 |
<div id="post-status-select" class="hide-if-js"> |
137 |
<input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo esc_attr( ( 'auto-draft' === $post->post_status ) ? 'draft' : $post->post_status ); ?>" /> |
|
138 |
<label for="post_status" class="screen-reader-text"><?php _e( 'Set status' ); ?></label> |
|
139 |
<select name="post_status" id="post_status"> |
|
140 |
<?php if ( 'publish' === $post->post_status ) : ?> |
|
141 |
<option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e( 'Published' ); ?></option> |
|
142 |
<?php elseif ( 'private' === $post->post_status ) : ?> |
|
143 |
<option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e( 'Privately Published' ); ?></option> |
|
144 |
<?php elseif ( 'future' === $post->post_status ) : ?> |
|
145 |
<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e( 'Scheduled' ); ?></option> |
|
146 |
<?php endif; ?> |
|
147 |
<option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e( 'Pending Review' ); ?></option> |
|
148 |
<?php if ( 'auto-draft' === $post->post_status ) : ?> |
|
149 |
<option<?php selected( $post->post_status, 'auto-draft' ); ?> value='draft'><?php _e( 'Draft' ); ?></option> |
|
150 |
<?php else : ?> |
|
151 |
<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e( 'Draft' ); ?></option> |
|
152 |
<?php endif; ?> |
|
153 |
</select> |
|
154 |
<a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e( 'OK' ); ?></a> |
|
155 |
<a href="#post_status" class="cancel-post-status hide-if-no-js button-cancel"><?php _e( 'Cancel' ); ?></a> |
|
156 |
</div> |
|
157 |
<?php |
|
9 | 158 |
} |
159 |
?> |
|
16 | 160 |
</div> |
0 | 161 |
|
16 | 162 |
<div class="misc-pub-section misc-pub-visibility" id="visibility"> |
163 |
<?php _e( 'Visibility:' ); ?> |
|
164 |
<span id="post-visibility-display"> |
|
165 |
<?php |
|
166 |
if ( 'private' === $post->post_status ) { |
|
167 |
$post->post_password = ''; |
|
168 |
$visibility = 'private'; |
|
169 |
$visibility_trans = __( 'Private' ); |
|
170 |
} elseif ( ! empty( $post->post_password ) ) { |
|
171 |
$visibility = 'password'; |
|
172 |
$visibility_trans = __( 'Password protected' ); |
|
173 |
} elseif ( 'post' === $post_type && is_sticky( $post_id ) ) { |
|
174 |
$visibility = 'public'; |
|
175 |
$visibility_trans = __( 'Public, Sticky' ); |
|
176 |
} else { |
|
177 |
$visibility = 'public'; |
|
178 |
$visibility_trans = __( 'Public' ); |
|
179 |
} |
|
0 | 180 |
|
16 | 181 |
echo esc_html( $visibility_trans ); |
182 |
?> |
|
183 |
</span> |
|
0 | 184 |
|
16 | 185 |
<?php if ( $can_publish ) { ?> |
186 |
<a href="#visibility" class="edit-visibility hide-if-no-js" role="button"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit visibility' ); ?></span></a> |
|
0 | 187 |
|
16 | 188 |
<div id="post-visibility-select" class="hide-if-js"> |
189 |
<input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo esc_attr( $post->post_password ); ?>" /> |
|
190 |
<?php if ( 'post' === $post_type ) : ?> |
|
191 |
<input type="checkbox" style="display:none" name="hidden_post_sticky" id="hidden-post-sticky" value="sticky" <?php checked( is_sticky( $post_id ) ); ?> /> |
|
192 |
<?php endif; ?> |
|
0 | 193 |
|
16 | 194 |
<input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo esc_attr( $visibility ); ?>" /> |
195 |
<input type="radio" name="visibility" id="visibility-radio-public" value="public" <?php checked( $visibility, 'public' ); ?> /> <label for="visibility-radio-public" class="selectit"><?php _e( 'Public' ); ?></label><br /> |
|
196 |
||
197 |
<?php if ( 'post' === $post_type && current_user_can( 'edit_others_posts' ) ) : ?> |
|
198 |
<span id="sticky-span"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked( is_sticky( $post_id ) ); ?> /> <label for="sticky" class="selectit"><?php _e( 'Stick this post to the front page' ); ?></label><br /></span> |
|
199 |
<?php endif; ?> |
|
200 |
||
201 |
<input type="radio" name="visibility" id="visibility-radio-password" value="password" <?php checked( $visibility, 'password' ); ?> /> <label for="visibility-radio-password" class="selectit"><?php _e( 'Password protected' ); ?></label><br /> |
|
202 |
<span id="password-span"><label for="post_password"><?php _e( 'Password:' ); ?></label> <input type="text" name="post_password" id="post_password" value="<?php echo esc_attr( $post->post_password ); ?>" maxlength="255" /><br /></span> |
|
0 | 203 |
|
16 | 204 |
<input type="radio" name="visibility" id="visibility-radio-private" value="private" <?php checked( $visibility, 'private' ); ?> /> <label for="visibility-radio-private" class="selectit"><?php _e( 'Private' ); ?></label><br /> |
0 | 205 |
|
16 | 206 |
<p> |
207 |
<a href="#visibility" class="save-post-visibility hide-if-no-js button"><?php _e( 'OK' ); ?></a> |
|
208 |
<a href="#visibility" class="cancel-post-visibility hide-if-no-js button-cancel"><?php _e( 'Cancel' ); ?></a> |
|
209 |
</p> |
|
210 |
</div> |
|
211 |
<?php } ?> |
|
212 |
</div> |
|
0 | 213 |
|
16 | 214 |
<?php |
215 |
/* translators: Publish box date string. 1: Date, 2: Time. See https://www.php.net/date */ |
|
216 |
$date_string = __( '%1$s at %2$s' ); |
|
217 |
/* translators: Publish box date format, see https://www.php.net/date */ |
|
218 |
$date_format = _x( 'M j, Y', 'publish box date format' ); |
|
219 |
/* translators: Publish box time format, see https://www.php.net/date */ |
|
220 |
$time_format = _x( 'H:i', 'publish box time format' ); |
|
0 | 221 |
|
16 | 222 |
if ( 0 !== $post_id ) { |
223 |
if ( 'future' === $post->post_status ) { // Scheduled for publishing at a future date. |
|
224 |
/* translators: Post date information. %s: Date on which the post is currently scheduled to be published. */ |
|
225 |
$stamp = __( 'Scheduled for: %s' ); |
|
226 |
} elseif ( 'publish' === $post->post_status || 'private' === $post->post_status ) { // Already published. |
|
227 |
/* translators: Post date information. %s: Date on which the post was published. */ |
|
228 |
$stamp = __( 'Published on: %s' ); |
|
229 |
} elseif ( '0000-00-00 00:00:00' === $post->post_date_gmt ) { // Draft, 1 or more saves, no date specified. |
|
230 |
$stamp = __( 'Publish <b>immediately</b>' ); |
|
231 |
} elseif ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // Draft, 1 or more saves, future date specified. |
|
232 |
/* translators: Post date information. %s: Date on which the post is to be published. */ |
|
233 |
$stamp = __( 'Schedule for: %s' ); |
|
234 |
} else { // Draft, 1 or more saves, date specified. |
|
235 |
/* translators: Post date information. %s: Date on which the post is to be published. */ |
|
236 |
$stamp = __( 'Publish on: %s' ); |
|
237 |
} |
|
238 |
$date = sprintf( |
|
239 |
$date_string, |
|
240 |
date_i18n( $date_format, strtotime( $post->post_date ) ), |
|
241 |
date_i18n( $time_format, strtotime( $post->post_date ) ) |
|
242 |
); |
|
243 |
} else { // Draft (no saves, and thus no date specified). |
|
9 | 244 |
$stamp = __( 'Publish <b>immediately</b>' ); |
16 | 245 |
$date = sprintf( |
246 |
$date_string, |
|
247 |
date_i18n( $date_format, strtotime( current_time( 'mysql' ) ) ), |
|
248 |
date_i18n( $time_format, strtotime( current_time( 'mysql' ) ) ) |
|
249 |
); |
|
9 | 250 |
} |
16 | 251 |
|
252 |
if ( ! empty( $args['args']['revisions_count'] ) ) : |
|
253 |
?> |
|
254 |
<div class="misc-pub-section misc-pub-revisions"> |
|
255 |
<?php |
|
256 |
/* translators: Post revisions heading. %s: The number of available revisions. */ |
|
257 |
printf( __( 'Revisions: %s' ), '<b>' . number_format_i18n( $args['args']['revisions_count'] ) . '</b>' ); |
|
258 |
?> |
|
259 |
<a class="hide-if-no-js" href="<?php echo esc_url( get_edit_post_link( $args['args']['revision_id'] ) ); ?>"><span aria-hidden="true"><?php _ex( 'Browse', 'revisions' ); ?></span> <span class="screen-reader-text"><?php _e( 'Browse revisions' ); ?></span></a> |
|
260 |
</div> |
|
261 |
<?php |
|
262 |
endif; |
|
263 |
||
264 |
if ( $can_publish ) : // Contributors don't get to choose the date of publish. |
|
265 |
?> |
|
266 |
<div class="misc-pub-section curtime misc-pub-curtime"> |
|
267 |
<span id="timestamp"> |
|
268 |
<?php printf( $stamp, '<b>' . $date . '</b>' ); ?> |
|
269 |
</span> |
|
270 |
<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" role="button"> |
|
271 |
<span aria-hidden="true"><?php _e( 'Edit' ); ?></span> |
|
272 |
<span class="screen-reader-text"><?php _e( 'Edit date and time' ); ?></span> |
|
273 |
</a> |
|
274 |
<fieldset id="timestampdiv" class="hide-if-js"> |
|
275 |
<legend class="screen-reader-text"><?php _e( 'Date and time' ); ?></legend> |
|
276 |
<?php touch_time( ( 'edit' === $action ), 1 ); ?> |
|
277 |
</fieldset> |
|
278 |
</div> |
|
279 |
<?php |
|
280 |
endif; |
|
0 | 281 |
|
16 | 282 |
if ( 'draft' === $post->post_status && get_post_meta( $post_id, '_customize_changeset_uuid', true ) ) : |
283 |
?> |
|
284 |
<div class="notice notice-info notice-alt inline"> |
|
285 |
<p> |
|
286 |
<?php |
|
287 |
printf( |
|
288 |
/* translators: %s: URL to the Customizer. */ |
|
289 |
__( 'This draft comes from your <a href="%s">unpublished customization changes</a>. You can edit, but there’s no need to publish now. It will be published automatically with those changes.' ), |
|
290 |
esc_url( |
|
291 |
add_query_arg( |
|
292 |
'changeset_uuid', |
|
293 |
rawurlencode( get_post_meta( $post_id, '_customize_changeset_uuid', true ) ), |
|
294 |
admin_url( 'customize.php' ) |
|
295 |
) |
|
296 |
) |
|
297 |
); |
|
298 |
?> |
|
299 |
</p> |
|
300 |
</div> |
|
301 |
<?php |
|
302 |
endif; |
|
0 | 303 |
|
16 | 304 |
/** |
305 |
* Fires after the post time/date setting in the Publish meta box. |
|
306 |
* |
|
307 |
* @since 2.9.0 |
|
308 |
* @since 4.4.0 Added the `$post` parameter. |
|
309 |
* |
|
310 |
* @param WP_Post $post WP_Post object for the current post. |
|
311 |
*/ |
|
312 |
do_action( 'post_submitbox_misc_actions', $post ); |
|
9 | 313 |
?> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
314 |
</div> |
16 | 315 |
<div class="clear"></div> |
0 | 316 |
</div> |
317 |
||
318 |
<div id="major-publishing-actions"> |
|
9 | 319 |
<?php |
320 |
/** |
|
321 |
* Fires at the beginning of the publishing actions section of the Publish meta box. |
|
322 |
* |
|
323 |
* @since 2.7.0 |
|
324 |
* @since 4.9.0 Added the `$post` parameter. |
|
325 |
* |
|
326 |
* @param WP_Post|null $post WP_Post object for the current post on Edit Post screen, |
|
327 |
* null on Edit Link screen. |
|
328 |
*/ |
|
329 |
do_action( 'post_submitbox_start', $post ); |
|
330 |
?> |
|
16 | 331 |
<div id="delete-action"> |
332 |
<?php |
|
333 |
if ( current_user_can( 'delete_post', $post_id ) ) { |
|
334 |
if ( ! EMPTY_TRASH_DAYS ) { |
|
335 |
$delete_text = __( 'Delete permanently' ); |
|
336 |
} else { |
|
337 |
$delete_text = __( 'Move to Trash' ); |
|
338 |
} |
|
339 |
?> |
|
340 |
<a class="submitdelete deletion" href="<?php echo get_delete_post_link( $post_id ); ?>"><?php echo $delete_text; ?></a> |
|
341 |
<?php |
|
9 | 342 |
} |
343 |
?> |
|
16 | 344 |
</div> |
345 |
||
346 |
<div id="publishing-action"> |
|
347 |
<span class="spinner"></span> |
|
348 |
<?php |
|
349 |
if ( ! in_array( $post->post_status, array( 'publish', 'future', 'private' ), true ) || 0 === $post_id ) { |
|
350 |
if ( $can_publish ) : |
|
351 |
if ( ! empty( $post->post_date_gmt ) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : |
|
352 |
?> |
|
353 |
<input name="original_publish" type="hidden" id="original_publish" value="<?php echo esc_attr_x( 'Schedule', 'post action/button label' ); ?>" /> |
|
354 |
<?php submit_button( _x( 'Schedule', 'post action/button label' ), 'primary large', 'publish', false ); ?> |
|
355 |
<?php |
|
356 |
else : |
|
357 |
?> |
|
358 |
<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Publish' ); ?>" /> |
|
359 |
<?php submit_button( __( 'Publish' ), 'primary large', 'publish', false ); ?> |
|
360 |
<?php |
|
361 |
endif; |
|
362 |
else : |
|
363 |
?> |
|
364 |
<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Submit for Review' ); ?>" /> |
|
365 |
<?php submit_button( __( 'Submit for Review' ), 'primary large', 'publish', false ); ?> |
|
366 |
<?php |
|
367 |
endif; |
|
368 |
} else { |
|
369 |
?> |
|
370 |
<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Update' ); ?>" /> |
|
371 |
<?php submit_button( __( 'Update' ), 'primary large', 'save', false, array( 'id' => 'publish' ) ); ?> |
|
372 |
<?php |
|
373 |
} |
|
374 |
?> |
|
375 |
</div> |
|
376 |
<div class="clear"></div> |
|
0 | 377 |
</div> |
378 |
||
379 |
</div> |
|
9 | 380 |
<?php |
0 | 381 |
} |
382 |
||
383 |
/** |
|
384 |
* Display attachment submit form fields. |
|
385 |
* |
|
386 |
* @since 3.5.0 |
|
387 |
* |
|
388 |
* @param object $post |
|
389 |
*/ |
|
390 |
function attachment_submit_meta_box( $post ) { |
|
9 | 391 |
?> |
0 | 392 |
<div class="submitbox" id="submitpost"> |
393 |
||
394 |
<div id="minor-publishing"> |
|
395 |
||
16 | 396 |
<?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key. ?> |
0 | 397 |
<div style="display:none;"> |
9 | 398 |
<?php submit_button( __( 'Save' ), '', 'save' ); ?> |
0 | 399 |
</div> |
400 |
||
401 |
||
402 |
<div id="misc-publishing-actions"> |
|
403 |
<div class="misc-pub-section curtime misc-pub-curtime"> |
|
9 | 404 |
<span id="timestamp"> |
16 | 405 |
<?php |
406 |
$uploaded_on = sprintf( |
|
407 |
/* translators: Publish box date string. 1: Date, 2: Time. See https://www.php.net/date */ |
|
408 |
__( '%1$s at %2$s' ), |
|
409 |
/* translators: Publish box date format, see https://www.php.net/date */ |
|
410 |
date_i18n( _x( 'M j, Y', 'publish box date format' ), strtotime( $post->post_date ) ), |
|
411 |
/* translators: Publish box time format, see https://www.php.net/date */ |
|
412 |
date_i18n( _x( 'H:i', 'publish box time format' ), strtotime( $post->post_date ) ) |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
413 |
); |
16 | 414 |
/* translators: Attachment information. %s: Date the attachment was uploaded. */ |
415 |
printf( __( 'Uploaded on: %s' ), '<b>' . $uploaded_on . '</b>' ); |
|
416 |
?> |
|
9 | 417 |
</span> |
0 | 418 |
</div><!-- .misc-pub-section --> |
419 |
||
5 | 420 |
<?php |
421 |
/** |
|
422 |
* Fires after the 'Uploaded on' section of the Save meta box |
|
423 |
* in the attachment editing screen. |
|
424 |
* |
|
425 |
* @since 3.5.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
426 |
* @since 4.9.0 Added the `$post` parameter. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
427 |
* |
9 | 428 |
* @param WP_Post $post WP_Post object for the current attachment. |
5 | 429 |
*/ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
430 |
do_action( 'attachment_submitbox_misc_actions', $post ); |
5 | 431 |
?> |
0 | 432 |
</div><!-- #misc-publishing-actions --> |
433 |
<div class="clear"></div> |
|
434 |
</div><!-- #minor-publishing --> |
|
435 |
||
436 |
<div id="major-publishing-actions"> |
|
437 |
<div id="delete-action"> |
|
438 |
<?php |
|
9 | 439 |
if ( current_user_can( 'delete_post', $post->ID ) ) { |
0 | 440 |
if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) { |
9 | 441 |
echo "<a class='submitdelete deletion' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Move to Trash' ) . '</a>'; |
0 | 442 |
} else { |
443 |
$delete_ays = ! MEDIA_TRASH ? " onclick='return showNotice.warn();'" : ''; |
|
16 | 444 |
echo "<a class='submitdelete deletion'$delete_ays href='" . get_delete_post_link( $post->ID, null, true ) . "'>" . __( 'Delete permanently' ) . '</a>'; |
0 | 445 |
} |
9 | 446 |
} |
0 | 447 |
?> |
448 |
</div> |
|
449 |
||
450 |
<div id="publishing-action"> |
|
451 |
<span class="spinner"></span> |
|
9 | 452 |
<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Update' ); ?>" /> |
453 |
<input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e( 'Update' ); ?>" /> |
|
0 | 454 |
</div> |
455 |
<div class="clear"></div> |
|
456 |
</div><!-- #major-publishing-actions --> |
|
457 |
||
458 |
</div> |
|
459 |
||
9 | 460 |
<?php |
0 | 461 |
} |
462 |
||
463 |
/** |
|
464 |
* Display post format form elements. |
|
465 |
* |
|
466 |
* @since 3.1.0 |
|
467 |
* |
|
5 | 468 |
* @param WP_Post $post Post object. |
469 |
* @param array $box { |
|
470 |
* Post formats meta box arguments. |
|
471 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
472 |
* @type string $id Meta box 'id' attribute. |
5 | 473 |
* @type string $title Meta box title. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
474 |
* @type callable $callback Meta box display callback. |
5 | 475 |
* @type array $args Extra meta box arguments. |
476 |
* } |
|
0 | 477 |
*/ |
478 |
function post_format_meta_box( $post, $box ) { |
|
479 |
if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->post_type, 'post-formats' ) ) : |
|
9 | 480 |
$post_formats = get_theme_support( 'post-formats' ); |
0 | 481 |
|
9 | 482 |
if ( is_array( $post_formats[0] ) ) : |
483 |
$post_format = get_post_format( $post->ID ); |
|
484 |
if ( ! $post_format ) { |
|
485 |
$post_format = '0'; |
|
486 |
} |
|
16 | 487 |
// Add in the current one if it isn't there yet, in case the current theme doesn't support it. |
488 |
if ( $post_format && ! in_array( $post_format, $post_formats[0], true ) ) { |
|
9 | 489 |
$post_formats[0][] = $post_format; |
490 |
} |
|
491 |
?> |
|
492 |
<div id="post-formats-select"> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
493 |
<fieldset> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
494 |
<legend class="screen-reader-text"><?php _e( 'Post Formats' ); ?></legend> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
495 |
<input type="radio" name="post_format" class="post-format" id="post-format-0" value="0" <?php checked( $post_format, '0' ); ?> /> <label for="post-format-0" class="post-format-icon post-format-standard"><?php echo get_post_format_string( 'standard' ); ?></label> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
496 |
<?php foreach ( $post_formats[0] as $format ) : ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
497 |
<br /><input type="radio" name="post_format" class="post-format" id="post-format-<?php echo esc_attr( $format ); ?>" value="<?php echo esc_attr( $format ); ?>" <?php checked( $post_format, $format ); ?> /> <label for="post-format-<?php echo esc_attr( $format ); ?>" class="post-format-icon post-format-<?php echo esc_attr( $format ); ?>"><?php echo esc_html( get_post_format_string( $format ) ); ?></label> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
498 |
<?php endforeach; ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
499 |
</fieldset> |
0 | 500 |
</div> |
9 | 501 |
<?php |
502 |
endif; |
|
503 |
endif; |
|
0 | 504 |
} |
505 |
||
506 |
/** |
|
507 |
* Display post tags form fields. |
|
508 |
* |
|
509 |
* @since 2.6.0 |
|
510 |
* |
|
5 | 511 |
* @todo Create taxonomy-agnostic wrapper for this. |
512 |
* |
|
513 |
* @param WP_Post $post Post object. |
|
514 |
* @param array $box { |
|
515 |
* Tags meta box arguments. |
|
516 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
517 |
* @type string $id Meta box 'id' attribute. |
5 | 518 |
* @type string $title Meta box title. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
519 |
* @type callable $callback Meta box display callback. |
5 | 520 |
* @type array $args { |
521 |
* Extra meta box arguments. |
|
522 |
* |
|
523 |
* @type string $taxonomy Taxonomy. Default 'post_tag'. |
|
524 |
* } |
|
525 |
* } |
|
0 | 526 |
*/ |
5 | 527 |
function post_tags_meta_box( $post, $box ) { |
528 |
$defaults = array( 'taxonomy' => 'post_tag' ); |
|
529 |
if ( ! isset( $box['args'] ) || ! is_array( $box['args'] ) ) { |
|
0 | 530 |
$args = array(); |
5 | 531 |
} else { |
0 | 532 |
$args = $box['args']; |
5 | 533 |
} |
16 | 534 |
$parsed_args = wp_parse_args( $args, $defaults ); |
535 |
$tax_name = esc_attr( $parsed_args['taxonomy'] ); |
|
536 |
$taxonomy = get_taxonomy( $parsed_args['taxonomy'] ); |
|
0 | 537 |
$user_can_assign_terms = current_user_can( $taxonomy->cap->assign_terms ); |
9 | 538 |
$comma = _x( ',', 'tag delimiter' ); |
539 |
$terms_to_edit = get_terms_to_edit( $post->ID, $tax_name ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
540 |
if ( ! is_string( $terms_to_edit ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
541 |
$terms_to_edit = ''; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
542 |
} |
9 | 543 |
?> |
0 | 544 |
<div class="tagsdiv" id="<?php echo $tax_name; ?>"> |
545 |
<div class="jaxtag"> |
|
546 |
<div class="nojs-tags hide-if-js"> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
547 |
<label for="tax-input-<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->add_or_remove_items; ?></label> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
548 |
<p><textarea name="<?php echo "tax_input[$tax_name]"; ?>" rows="3" cols="20" class="the-tags" id="tax-input-<?php echo $tax_name; ?>" <?php disabled( ! $user_can_assign_terms ); ?> aria-describedby="new-tag-<?php echo $tax_name; ?>-desc"><?php echo str_replace( ',', $comma . ' ', $terms_to_edit ); // textarea_escaped by esc_attr() ?></textarea></p> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
549 |
</div> |
9 | 550 |
<?php if ( $user_can_assign_terms ) : ?> |
0 | 551 |
<div class="ajaxtag hide-if-no-js"> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
552 |
<label class="screen-reader-text" for="new-tag-<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->add_new_item; ?></label> |
9 | 553 |
<input data-wp-taxonomy="<?php echo $tax_name; ?>" type="text" id="new-tag-<?php echo $tax_name; ?>" name="newtag[<?php echo $tax_name; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" aria-describedby="new-tag-<?php echo $tax_name; ?>-desc" value="" /> |
554 |
<input type="button" class="button tagadd" value="<?php esc_attr_e( 'Add' ); ?>" /> |
|
0 | 555 |
</div> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
556 |
<p class="howto" id="new-tag-<?php echo $tax_name; ?>-desc"><?php echo $taxonomy->labels->separate_items_with_commas; ?></p> |
9 | 557 |
<?php elseif ( empty( $terms_to_edit ) ) : ?> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
558 |
<p><?php echo $taxonomy->labels->no_terms; ?></p> |
0 | 559 |
<?php endif; ?> |
560 |
</div> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
561 |
<ul class="tagchecklist" role="list"></ul> |
0 | 562 |
</div> |
9 | 563 |
<?php if ( $user_can_assign_terms ) : ?> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
564 |
<p class="hide-if-no-js"><button type="button" class="button-link tagcloud-link" id="link-<?php echo $tax_name; ?>" aria-expanded="false"><?php echo $taxonomy->labels->choose_from_most_used; ?></button></p> |
0 | 565 |
<?php endif; ?> |
9 | 566 |
<?php |
0 | 567 |
} |
568 |
||
569 |
/** |
|
570 |
* Display post categories form fields. |
|
571 |
* |
|
572 |
* @since 2.6.0 |
|
573 |
* |
|
5 | 574 |
* @todo Create taxonomy-agnostic wrapper for this. |
575 |
* |
|
576 |
* @param WP_Post $post Post object. |
|
577 |
* @param array $box { |
|
578 |
* Categories meta box arguments. |
|
579 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
580 |
* @type string $id Meta box 'id' attribute. |
5 | 581 |
* @type string $title Meta box title. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
582 |
* @type callable $callback Meta box display callback. |
5 | 583 |
* @type array $args { |
584 |
* Extra meta box arguments. |
|
585 |
* |
|
586 |
* @type string $taxonomy Taxonomy. Default 'category'. |
|
587 |
* } |
|
588 |
* } |
|
0 | 589 |
*/ |
590 |
function post_categories_meta_box( $post, $box ) { |
|
5 | 591 |
$defaults = array( 'taxonomy' => 'category' ); |
592 |
if ( ! isset( $box['args'] ) || ! is_array( $box['args'] ) ) { |
|
0 | 593 |
$args = array(); |
5 | 594 |
} else { |
0 | 595 |
$args = $box['args']; |
5 | 596 |
} |
16 | 597 |
$parsed_args = wp_parse_args( $args, $defaults ); |
598 |
$tax_name = esc_attr( $parsed_args['taxonomy'] ); |
|
599 |
$taxonomy = get_taxonomy( $parsed_args['taxonomy'] ); |
|
0 | 600 |
?> |
5 | 601 |
<div id="taxonomy-<?php echo $tax_name; ?>" class="categorydiv"> |
602 |
<ul id="<?php echo $tax_name; ?>-tabs" class="category-tabs"> |
|
603 |
<li class="tabs"><a href="#<?php echo $tax_name; ?>-all"><?php echo $taxonomy->labels->all_items; ?></a></li> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
604 |
<li class="hide-if-no-js"><a href="#<?php echo $tax_name; ?>-pop"><?php echo esc_html( $taxonomy->labels->most_used ); ?></a></li> |
0 | 605 |
</ul> |
606 |
||
5 | 607 |
<div id="<?php echo $tax_name; ?>-pop" class="tabs-panel" style="display: none;"> |
608 |
<ul id="<?php echo $tax_name; ?>checklist-pop" class="categorychecklist form-no-clear" > |
|
609 |
<?php $popular_ids = wp_popular_terms_checklist( $tax_name ); ?> |
|
0 | 610 |
</ul> |
611 |
</div> |
|
612 |
||
5 | 613 |
<div id="<?php echo $tax_name; ?>-all" class="tabs-panel"> |
0 | 614 |
<?php |
16 | 615 |
$name = ( 'category' === $tax_name ) ? 'post_category' : 'tax_input[' . $tax_name . ']'; |
616 |
// Allows for an empty term set to be sent. 0 is an invalid term ID and will be ignored by empty() checks. |
|
617 |
echo "<input type='hidden' name='{$name}[]' value='0' />"; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
618 |
?> |
5 | 619 |
<ul id="<?php echo $tax_name; ?>checklist" data-wp-lists="list:<?php echo $tax_name; ?>" class="categorychecklist form-no-clear"> |
9 | 620 |
<?php |
621 |
wp_terms_checklist( |
|
622 |
$post->ID, |
|
623 |
array( |
|
624 |
'taxonomy' => $tax_name, |
|
625 |
'popular_cats' => $popular_ids, |
|
626 |
) |
|
627 |
); |
|
628 |
?> |
|
0 | 629 |
</ul> |
630 |
</div> |
|
5 | 631 |
<?php if ( current_user_can( $taxonomy->cap->edit_terms ) ) : ?> |
632 |
<div id="<?php echo $tax_name; ?>-adder" class="wp-hidden-children"> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
633 |
<a id="<?php echo $tax_name; ?>-add-toggle" href="#<?php echo $tax_name; ?>-add" class="hide-if-no-js taxonomy-add-new"> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
634 |
<?php |
16 | 635 |
/* translators: %s: Add New taxonomy label. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
636 |
printf( __( '+ %s' ), $taxonomy->labels->add_new_item ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
637 |
?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
638 |
</a> |
5 | 639 |
<p id="<?php echo $tax_name; ?>-add" class="category-add wp-hidden-child"> |
640 |
<label class="screen-reader-text" for="new<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->add_new_item; ?></label> |
|
641 |
<input type="text" name="new<?php echo $tax_name; ?>" id="new<?php echo $tax_name; ?>" class="form-required form-input-tip" value="<?php echo esc_attr( $taxonomy->labels->new_item_name ); ?>" aria-required="true"/> |
|
642 |
<label class="screen-reader-text" for="new<?php echo $tax_name; ?>_parent"> |
|
643 |
<?php echo $taxonomy->labels->parent_item_colon; ?> |
|
0 | 644 |
</label> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
645 |
<?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
646 |
$parent_dropdown_args = array( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
647 |
'taxonomy' => $tax_name, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
648 |
'hide_empty' => 0, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
649 |
'name' => 'new' . $tax_name . '_parent', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
650 |
'orderby' => 'name', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
651 |
'hierarchical' => 1, |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
652 |
'show_option_none' => '— ' . $taxonomy->labels->parent_item . ' —', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
653 |
); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
654 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
655 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
656 |
* Filters the arguments for the taxonomy parent dropdown on the Post Edit page. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
657 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
658 |
* @since 4.4.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
659 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
660 |
* @param array $parent_dropdown_args { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
661 |
* Optional. Array of arguments to generate parent dropdown. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
662 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
663 |
* @type string $taxonomy Name of the taxonomy to retrieve. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
664 |
* @type bool $hide_if_empty True to skip generating markup if no |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
665 |
* categories are found. Default 0. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
666 |
* @type string $name Value for the 'name' attribute |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
667 |
* of the select element. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
668 |
* Default "new{$tax_name}_parent". |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
669 |
* @type string $orderby Which column to use for ordering |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
670 |
* terms. Default 'name'. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
671 |
* @type bool|int $hierarchical Whether to traverse the taxonomy |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
672 |
* hierarchy. Default 1. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
673 |
* @type string $show_option_none Text to display for the "none" option. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
674 |
* Default "— {$parent} —", |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
675 |
* where `$parent` is 'parent_item' |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
676 |
* taxonomy label. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
677 |
* } |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
678 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
679 |
$parent_dropdown_args = apply_filters( 'post_edit_category_parent_dropdown_args', $parent_dropdown_args ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
680 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
681 |
wp_dropdown_categories( $parent_dropdown_args ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
682 |
?> |
5 | 683 |
<input type="button" id="<?php echo $tax_name; ?>-add-submit" data-wp-lists="add:<?php echo $tax_name; ?>checklist:<?php echo $tax_name; ?>-add" class="button category-add-submit" value="<?php echo esc_attr( $taxonomy->labels->add_new_item ); ?>" /> |
684 |
<?php wp_nonce_field( 'add-' . $tax_name, '_ajax_nonce-add-' . $tax_name, false ); ?> |
|
685 |
<span id="<?php echo $tax_name; ?>-ajax-response"></span> |
|
0 | 686 |
</p> |
687 |
</div> |
|
688 |
<?php endif; ?> |
|
689 |
</div> |
|
690 |
<?php |
|
691 |
} |
|
692 |
||
693 |
/** |
|
694 |
* Display post excerpt form fields. |
|
695 |
* |
|
696 |
* @since 2.6.0 |
|
697 |
* |
|
698 |
* @param object $post |
|
699 |
*/ |
|
9 | 700 |
function post_excerpt_meta_box( $post ) { |
701 |
?> |
|
702 |
<label class="screen-reader-text" for="excerpt"><?php _e( 'Excerpt' ); ?></label><textarea rows="1" cols="40" name="excerpt" id="excerpt"><?php echo $post->post_excerpt; // textarea_escaped ?></textarea> |
|
703 |
<p> |
|
704 |
<?php |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
705 |
printf( |
16 | 706 |
/* translators: %s: Documentation URL. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
707 |
__( 'Excerpts are optional hand-crafted summaries of your content that can be used in your theme. <a href="%s">Learn more about manual excerpts</a>.' ), |
16 | 708 |
__( 'https://wordpress.org/support/article/excerpt/' ) |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
709 |
); |
9 | 710 |
?> |
711 |
</p> |
|
712 |
<?php |
|
0 | 713 |
} |
714 |
||
715 |
/** |
|
716 |
* Display trackback links form fields. |
|
717 |
* |
|
718 |
* @since 2.6.0 |
|
719 |
* |
|
720 |
* @param object $post |
|
721 |
*/ |
|
9 | 722 |
function post_trackback_meta_box( $post ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
723 |
$form_trackback = '<input type="text" name="trackback_url" id="trackback_url" class="code" value="' . |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
724 |
esc_attr( str_replace( "\n", ' ', $post->to_ping ) ) . '" aria-describedby="trackback-url-desc" />'; |
16 | 725 |
|
726 |
if ( '' !== $post->pinged ) { |
|
9 | 727 |
$pings = '<p>' . __( 'Already pinged:' ) . '</p><ul>'; |
728 |
$already_pinged = explode( "\n", trim( $post->pinged ) ); |
|
729 |
foreach ( $already_pinged as $pinged_url ) { |
|
730 |
$pings .= "\n\t<li>" . esc_html( $pinged_url ) . '</li>'; |
|
0 | 731 |
} |
732 |
$pings .= '</ul>'; |
|
733 |
} |
|
734 |
||
9 | 735 |
?> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
736 |
<p> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
737 |
<label for="trackback_url"><?php _e( 'Send trackbacks to:' ); ?></label> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
738 |
<?php echo $form_trackback; ?> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
739 |
</p> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
740 |
<p id="trackback-url-desc" class="howto"><?php _e( 'Separate multiple URLs with spaces' ); ?></p> |
9 | 741 |
<p> |
742 |
<?php |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
743 |
printf( |
16 | 744 |
/* translators: %s: Documentation URL. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
745 |
__( 'Trackbacks are a way to notify legacy blog systems that you’ve linked to them. If you link other WordPress sites, they’ll be notified automatically using <a href="%s">pingbacks</a>, no other action necessary.' ), |
16 | 746 |
__( 'https://wordpress.org/support/article/introduction-to-blogging/#comments' ) |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
747 |
); |
9 | 748 |
?> |
749 |
</p> |
|
750 |
<?php |
|
751 |
if ( ! empty( $pings ) ) { |
|
752 |
echo $pings; |
|
753 |
} |
|
0 | 754 |
} |
755 |
||
756 |
/** |
|
757 |
* Display custom fields form fields. |
|
758 |
* |
|
759 |
* @since 2.6.0 |
|
760 |
* |
|
761 |
* @param object $post |
|
762 |
*/ |
|
9 | 763 |
function post_custom_meta_box( $post ) { |
764 |
?> |
|
0 | 765 |
<div id="postcustomstuff"> |
766 |
<div id="ajax-response"></div> |
|
9 | 767 |
<?php |
768 |
$metadata = has_meta( $post->ID ); |
|
769 |
foreach ( $metadata as $key => $value ) { |
|
770 |
if ( is_protected_meta( $metadata[ $key ]['meta_key'], 'post' ) || ! current_user_can( 'edit_post_meta', $post->ID, $metadata[ $key ]['meta_key'] ) ) { |
|
771 |
unset( $metadata[ $key ] ); |
|
772 |
} |
|
773 |
} |
|
774 |
list_meta( $metadata ); |
|
775 |
meta_form( $post ); |
|
776 |
?> |
|
0 | 777 |
</div> |
9 | 778 |
<p> |
779 |
<?php |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
780 |
printf( |
16 | 781 |
/* translators: %s: Documentation URL. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
782 |
__( 'Custom fields can be used to add extra metadata to a post that you can <a href="%s">use in your theme</a>.' ), |
16 | 783 |
__( 'https://wordpress.org/support/article/custom-fields/' ) |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
784 |
); |
9 | 785 |
?> |
786 |
</p> |
|
787 |
<?php |
|
0 | 788 |
} |
789 |
||
790 |
/** |
|
791 |
* Display comments status form fields. |
|
792 |
* |
|
793 |
* @since 2.6.0 |
|
794 |
* |
|
795 |
* @param object $post |
|
796 |
*/ |
|
9 | 797 |
function post_comment_status_meta_box( $post ) { |
798 |
?> |
|
0 | 799 |
<input name="advanced_view" type="hidden" value="1" /> |
800 |
<p class="meta-options"> |
|
9 | 801 |
<label for="comment_status" class="selectit"><input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked( $post->comment_status, 'open' ); ?> /> <?php _e( 'Allow comments' ); ?></label><br /> |
802 |
<label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked( $post->ping_status, 'open' ); ?> /> |
|
803 |
<?php |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
804 |
printf( |
16 | 805 |
/* translators: %s: Documentation URL. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
806 |
__( 'Allow <a href="%s">trackbacks and pingbacks</a> on this page' ), |
16 | 807 |
__( 'https://wordpress.org/support/article/introduction-to-blogging/#managing-comments' ) |
9 | 808 |
); |
809 |
?> |
|
810 |
</label> |
|
5 | 811 |
<?php |
812 |
/** |
|
813 |
* Fires at the end of the Discussion meta box on the post editing screen. |
|
814 |
* |
|
815 |
* @since 3.1.0 |
|
816 |
* |
|
817 |
* @param WP_Post $post WP_Post object of the current post. |
|
818 |
*/ |
|
16 | 819 |
do_action( 'post_comment_status_meta_box-options', $post ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
5 | 820 |
?> |
0 | 821 |
</p> |
9 | 822 |
<?php |
0 | 823 |
} |
824 |
||
825 |
/** |
|
826 |
* Display comments for post table header |
|
827 |
* |
|
828 |
* @since 3.0.0 |
|
829 |
* |
|
830 |
* @param array $result table header rows |
|
831 |
* @return array |
|
832 |
*/ |
|
9 | 833 |
function post_comment_meta_box_thead( $result ) { |
834 |
unset( $result['cb'], $result['response'] ); |
|
0 | 835 |
return $result; |
836 |
} |
|
837 |
||
838 |
/** |
|
839 |
* Display comments for post. |
|
840 |
* |
|
841 |
* @since 2.8.0 |
|
842 |
* |
|
843 |
* @param object $post |
|
844 |
*/ |
|
845 |
function post_comment_meta_box( $post ) { |
|
846 |
wp_nonce_field( 'get-comments', 'add_comment_nonce', false ); |
|
847 |
?> |
|
16 | 848 |
<p class="hide-if-no-js" id="add-new-comment"><button type="button" class="button" onclick="window.commentReply && commentReply.addcomment(<?php echo $post->ID; ?>);"><?php _e( 'Add Comment' ); ?></button></p> |
0 | 849 |
<?php |
850 |
||
9 | 851 |
$total = get_comments( |
852 |
array( |
|
853 |
'post_id' => $post->ID, |
|
854 |
'number' => 1, |
|
855 |
'count' => true, |
|
856 |
) |
|
857 |
); |
|
858 |
$wp_list_table = _get_list_table( 'WP_Post_Comments_List_Table' ); |
|
0 | 859 |
$wp_list_table->display( true ); |
860 |
||
861 |
if ( 1 > $total ) { |
|
9 | 862 |
echo '<p id="no-comments">' . __( 'No comments yet.' ) . '</p>'; |
0 | 863 |
} else { |
864 |
$hidden = get_hidden_meta_boxes( get_current_screen() ); |
|
16 | 865 |
if ( ! in_array( 'commentsdiv', $hidden, true ) ) { |
0 | 866 |
?> |
867 |
<script type="text/javascript">jQuery(document).ready(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script> |
|
868 |
<?php |
|
869 |
} |
|
870 |
||
871 |
?> |
|
9 | 872 |
<p class="hide-if-no-js" id="show-comments"><a href="#commentstatusdiv" onclick="commentsBox.load(<?php echo $total; ?>);return false;"><?php _e( 'Show comments' ); ?></a> <span class="spinner"></span></p> |
0 | 873 |
<?php |
874 |
} |
|
875 |
||
876 |
wp_comment_trashnotice(); |
|
877 |
} |
|
878 |
||
879 |
/** |
|
880 |
* Display slug form fields. |
|
881 |
* |
|
882 |
* @since 2.6.0 |
|
883 |
* |
|
884 |
* @param object $post |
|
885 |
*/ |
|
9 | 886 |
function post_slug_meta_box( $post ) { |
887 |
/** This filter is documented in wp-admin/edit-tag-form.php */ |
|
888 |
$editable_slug = apply_filters( 'editable_slug', $post->post_name, $post ); |
|
889 |
?> |
|
890 |
<label class="screen-reader-text" for="post_name"><?php _e( 'Slug' ); ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo esc_attr( $editable_slug ); ?>" /> |
|
891 |
<?php |
|
0 | 892 |
} |
893 |
||
894 |
/** |
|
895 |
* Display form field with list of authors. |
|
896 |
* |
|
897 |
* @since 2.6.0 |
|
898 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
899 |
* @global int $user_ID |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
900 |
* |
0 | 901 |
* @param object $post |
902 |
*/ |
|
9 | 903 |
function post_author_meta_box( $post ) { |
0 | 904 |
global $user_ID; |
9 | 905 |
?> |
906 |
<label class="screen-reader-text" for="post_author_override"><?php _e( 'Author' ); ?></label> |
|
907 |
<?php |
|
908 |
wp_dropdown_users( |
|
909 |
array( |
|
910 |
'who' => 'authors', |
|
911 |
'name' => 'post_author_override', |
|
912 |
'selected' => empty( $post->ID ) ? $user_ID : $post->post_author, |
|
913 |
'include_selected' => true, |
|
914 |
'show' => 'display_name_with_login', |
|
915 |
) |
|
916 |
); |
|
0 | 917 |
} |
918 |
||
919 |
/** |
|
920 |
* Display list of revisions. |
|
921 |
* |
|
922 |
* @since 2.6.0 |
|
923 |
* |
|
924 |
* @param object $post |
|
925 |
*/ |
|
926 |
function post_revisions_meta_box( $post ) { |
|
927 |
wp_list_post_revisions( $post ); |
|
928 |
} |
|
929 |
||
16 | 930 |
// |
931 |
// Page-related Meta Boxes. |
|
932 |
// |
|
0 | 933 |
|
934 |
/** |
|
935 |
* Display page attributes form fields. |
|
936 |
* |
|
937 |
* @since 2.7.0 |
|
938 |
* |
|
939 |
* @param object $post |
|
940 |
*/ |
|
9 | 941 |
function page_attributes_meta_box( $post ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
942 |
if ( is_post_type_hierarchical( $post->post_type ) ) : |
0 | 943 |
$dropdown_args = array( |
944 |
'post_type' => $post->post_type, |
|
945 |
'exclude_tree' => $post->ID, |
|
946 |
'selected' => $post->post_parent, |
|
947 |
'name' => 'parent_id', |
|
9 | 948 |
'show_option_none' => __( '(no parent)' ), |
0 | 949 |
'sort_column' => 'menu_order, post_title', |
950 |
'echo' => 0, |
|
951 |
); |
|
952 |
||
5 | 953 |
/** |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
954 |
* Filters the arguments used to generate a Pages drop-down element. |
5 | 955 |
* |
956 |
* @since 3.3.0 |
|
957 |
* |
|
958 |
* @see wp_dropdown_pages() |
|
959 |
* |
|
960 |
* @param array $dropdown_args Array of arguments used to generate the pages drop-down. |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
961 |
* @param WP_Post $post The current post. |
5 | 962 |
*/ |
0 | 963 |
$dropdown_args = apply_filters( 'page_attributes_dropdown_pages_args', $dropdown_args, $post ); |
9 | 964 |
$pages = wp_dropdown_pages( $dropdown_args ); |
965 |
if ( ! empty( $pages ) ) : |
|
966 |
?> |
|
16 | 967 |
<p class="post-attributes-label-wrapper parent-id-label-wrapper"><label class="post-attributes-label" for="parent_id"><?php _e( 'Parent' ); ?></label></p> |
9 | 968 |
<?php echo $pages; ?> |
969 |
<?php |
|
16 | 970 |
endif; // End empty pages check. |
971 |
endif; // End hierarchical check. |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
972 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
973 |
if ( count( get_page_templates( $post ) ) > 0 && get_option( 'page_for_posts' ) != $post->ID ) : |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
974 |
$template = ! empty( $post->page_template ) ? $post->page_template : false; |
0 | 975 |
?> |
16 | 976 |
<p class="post-attributes-label-wrapper page-template-label-wrapper"><label class="post-attributes-label" for="page_template"><?php _e( 'Template' ); ?></label> |
9 | 977 |
<?php |
978 |
/** |
|
979 |
* Fires immediately after the label inside the 'Template' section |
|
980 |
* of the 'Page Attributes' meta box. |
|
981 |
* |
|
982 |
* @since 4.4.0 |
|
983 |
* |
|
984 |
* @param string $template The template used for the current post. |
|
985 |
* @param WP_Post $post The current post. |
|
986 |
*/ |
|
987 |
do_action( 'page_attributes_meta_box_template', $template, $post ); |
|
988 |
?> |
|
989 |
</p> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
990 |
<select name="page_template" id="page_template"> |
9 | 991 |
<?php |
992 |
/** |
|
993 |
* Filters the title of the default page template displayed in the drop-down. |
|
994 |
* |
|
995 |
* @since 4.1.0 |
|
996 |
* |
|
997 |
* @param string $label The display value for the default page template title. |
|
998 |
* @param string $context Where the option label is displayed. Possible values |
|
999 |
* include 'meta-box' or 'quick-edit'. |
|
1000 |
*/ |
|
16 | 1001 |
$default_title = apply_filters( 'default_page_template_title', __( 'Default template' ), 'meta-box' ); |
9 | 1002 |
?> |
5 | 1003 |
<option value="default"><?php echo esc_html( $default_title ); ?></option> |
9 | 1004 |
<?php page_template_dropdown( $template, $post->post_type ); ?> |
0 | 1005 |
</select> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1006 |
<?php endif; ?> |
9 | 1007 |
<?php if ( post_type_supports( $post->post_type, 'page-attributes' ) ) : ?> |
16 | 1008 |
<p class="post-attributes-label-wrapper menu-order-label-wrapper"><label class="post-attributes-label" for="menu_order"><?php _e( 'Order' ); ?></label></p> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1009 |
<input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo esc_attr( $post->menu_order ); ?>" /> |
9 | 1010 |
<?php |
1011 |
/** |
|
1012 |
* Fires before the help hint text in the 'Page Attributes' meta box. |
|
1013 |
* |
|
1014 |
* @since 4.9.0 |
|
1015 |
* |
|
1016 |
* @param WP_Post $post The current post. |
|
1017 |
*/ |
|
1018 |
do_action( 'page_attributes_misc_attributes', $post ); |
|
1019 |
?> |
|
16 | 1020 |
<?php if ( 'page' === $post->post_type && get_current_screen()->get_help_tabs() ) : ?> |
1021 |
<p class="post-attributes-help-text"><?php _e( 'Need help? Use the Help tab above the screen title.' ); ?></p> |
|
9 | 1022 |
<?php |
1023 |
endif; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1024 |
endif; |
0 | 1025 |
} |
1026 |
||
16 | 1027 |
// |
1028 |
// Link-related Meta Boxes. |
|
1029 |
// |
|
0 | 1030 |
|
1031 |
/** |
|
1032 |
* Display link create form fields. |
|
1033 |
* |
|
1034 |
* @since 2.7.0 |
|
1035 |
* |
|
1036 |
* @param object $link |
|
1037 |
*/ |
|
9 | 1038 |
function link_submit_meta_box( $link ) { |
1039 |
?> |
|
0 | 1040 |
<div class="submitbox" id="submitlink"> |
1041 |
||
1042 |
<div id="minor-publishing"> |
|
1043 |
||
16 | 1044 |
<?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key. ?> |
0 | 1045 |
<div style="display:none;"> |
9 | 1046 |
<?php submit_button( __( 'Save' ), '', 'save', false ); ?> |
0 | 1047 |
</div> |
1048 |
||
1049 |
<div id="minor-publishing-actions"> |
|
1050 |
<div id="preview-action"> |
|
9 | 1051 |
<?php if ( ! empty( $link->link_id ) ) { ?> |
1052 |
<a class="preview button" href="<?php echo $link->link_url; ?>" target="_blank"><?php _e( 'Visit Link' ); ?></a> |
|
0 | 1053 |
<?php } ?> |
1054 |
</div> |
|
1055 |
<div class="clear"></div> |
|
1056 |
</div> |
|
1057 |
||
1058 |
<div id="misc-publishing-actions"> |
|
1059 |
<div class="misc-pub-section misc-pub-private"> |
|
9 | 1060 |
<label for="link_private" class="selectit"><input id="link_private" name="link_visible" type="checkbox" value="N" <?php checked( $link->link_visible, 'N' ); ?> /> <?php _e( 'Keep this link private' ); ?></label> |
0 | 1061 |
</div> |
1062 |
</div> |
|
1063 |
||
1064 |
</div> |
|
1065 |
||
1066 |
<div id="major-publishing-actions"> |
|
9 | 1067 |
<?php |
1068 |
/** This action is documented in wp-admin/includes/meta-boxes.php */ |
|
1069 |
do_action( 'post_submitbox_start', null ); |
|
1070 |
?> |
|
0 | 1071 |
<div id="delete-action"> |
9 | 1072 |
<?php |
16 | 1073 |
if ( ! empty( $_GET['action'] ) && 'edit' === $_GET['action'] && current_user_can( 'manage_links' ) ) { |
1074 |
printf( |
|
1075 |
'<a class="submitdelete deletion" href="%s" onclick="return confirm( \'%s\' );">%s</a>', |
|
1076 |
wp_nonce_url( "link.php?action=delete&link_id=$link->link_id", 'delete-bookmark_' . $link->link_id ), |
|
1077 |
/* translators: %s: Link name. */ |
|
1078 |
esc_js( sprintf( __( "You are about to delete this link '%s'\n 'Cancel' to stop, 'OK' to delete." ), $link->link_name ) ), |
|
1079 |
__( 'Delete' ) |
|
1080 |
); |
|
1081 |
} |
|
1082 |
?> |
|
0 | 1083 |
</div> |
1084 |
||
1085 |
<div id="publishing-action"> |
|
9 | 1086 |
<?php if ( ! empty( $link->link_id ) ) { ?> |
1087 |
<input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e( 'Update Link' ); ?>" /> |
|
0 | 1088 |
<?php } else { ?> |
9 | 1089 |
<input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e( 'Add Link' ); ?>" /> |
0 | 1090 |
<?php } ?> |
1091 |
</div> |
|
1092 |
<div class="clear"></div> |
|
1093 |
</div> |
|
9 | 1094 |
<?php |
1095 |
/** |
|
1096 |
* Fires at the end of the Publish box in the Link editing screen. |
|
1097 |
* |
|
1098 |
* @since 2.5.0 |
|
1099 |
*/ |
|
1100 |
do_action( 'submitlink_box' ); |
|
1101 |
?> |
|
0 | 1102 |
<div class="clear"></div> |
1103 |
</div> |
|
9 | 1104 |
<?php |
0 | 1105 |
} |
1106 |
||
1107 |
/** |
|
1108 |
* Display link categories form fields. |
|
1109 |
* |
|
1110 |
* @since 2.6.0 |
|
1111 |
* |
|
1112 |
* @param object $link |
|
1113 |
*/ |
|
9 | 1114 |
function link_categories_meta_box( $link ) { |
1115 |
?> |
|
0 | 1116 |
<div id="taxonomy-linkcategory" class="categorydiv"> |
1117 |
<ul id="category-tabs" class="category-tabs"> |
|
16 | 1118 |
<li class="tabs"><a href="#categories-all"><?php _e( 'All categories' ); ?></a></li> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1119 |
<li class="hide-if-no-js"><a href="#categories-pop"><?php _ex( 'Most Used', 'categories' ); ?></a></li> |
0 | 1120 |
</ul> |
1121 |
||
1122 |
<div id="categories-all" class="tabs-panel"> |
|
1123 |
<ul id="categorychecklist" data-wp-lists="list:category" class="categorychecklist form-no-clear"> |
|
1124 |
<?php |
|
9 | 1125 |
if ( isset( $link->link_id ) ) { |
1126 |
wp_link_category_checklist( $link->link_id ); |
|
1127 |
} else { |
|
0 | 1128 |
wp_link_category_checklist(); |
9 | 1129 |
} |
0 | 1130 |
?> |
1131 |
</ul> |
|
1132 |
</div> |
|
1133 |
||
1134 |
<div id="categories-pop" class="tabs-panel" style="display: none;"> |
|
1135 |
<ul id="categorychecklist-pop" class="categorychecklist form-no-clear"> |
|
9 | 1136 |
<?php wp_popular_terms_checklist( 'link_category' ); ?> |
0 | 1137 |
</ul> |
1138 |
</div> |
|
1139 |
||
1140 |
<div id="category-adder" class="wp-hidden-children"> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1141 |
<a id="category-add-toggle" href="#category-add" class="taxonomy-add-new"><?php _e( '+ Add New Category' ); ?></a> |
0 | 1142 |
<p id="link-category-add" class="wp-hidden-child"> |
1143 |
<label class="screen-reader-text" for="newcat"><?php _e( '+ Add New Category' ); ?></label> |
|
1144 |
<input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" aria-required="true" /> |
|
1145 |
<input type="button" id="link-category-add-submit" data-wp-lists="add:categorychecklist:link-category-add" class="button" value="<?php esc_attr_e( 'Add' ); ?>" /> |
|
1146 |
<?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?> |
|
1147 |
<span id="category-ajax-response"></span> |
|
1148 |
</p> |
|
1149 |
</div> |
|
1150 |
</div> |
|
9 | 1151 |
<?php |
0 | 1152 |
} |
1153 |
||
1154 |
/** |
|
1155 |
* Display form fields for changing link target. |
|
1156 |
* |
|
1157 |
* @since 2.6.0 |
|
1158 |
* |
|
1159 |
* @param object $link |
|
1160 |
*/ |
|
9 | 1161 |
function link_target_meta_box( $link ) { |
1162 |
||
1163 |
?> |
|
1164 |
<fieldset><legend class="screen-reader-text"><span><?php _e( 'Target' ); ?></span></legend> |
|
0 | 1165 |
<p><label for="link_target_blank" class="selectit"> |
16 | 1166 |
<input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo ( isset( $link->link_target ) && ( '_blank' === $link->link_target ) ? 'checked="checked"' : '' ); ?> /> |
9 | 1167 |
<?php _e( '<code>_blank</code> — new window or tab.' ); ?></label></p> |
0 | 1168 |
<p><label for="link_target_top" class="selectit"> |
16 | 1169 |
<input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo ( isset( $link->link_target ) && ( '_top' === $link->link_target ) ? 'checked="checked"' : '' ); ?> /> |
9 | 1170 |
<?php _e( '<code>_top</code> — current window or tab, with no frames.' ); ?></label></p> |
0 | 1171 |
<p><label for="link_target_none" class="selectit"> |
16 | 1172 |
<input id="link_target_none" type="radio" name="link_target" value="" <?php echo ( isset( $link->link_target ) && ( '' === $link->link_target ) ? 'checked="checked"' : '' ); ?> /> |
9 | 1173 |
<?php _e( '<code>_none</code> — same window or tab.' ); ?></label></p> |
0 | 1174 |
</fieldset> |
9 | 1175 |
<p><?php _e( 'Choose the target frame for your link.' ); ?></p> |
1176 |
<?php |
|
0 | 1177 |
} |
1178 |
||
1179 |
/** |
|
1180 |
* Display checked checkboxes attribute for xfn microformat options. |
|
1181 |
* |
|
1182 |
* @since 1.0.1 |
|
1183 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1184 |
* @global object $link |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1185 |
* |
0 | 1186 |
* @param string $class |
1187 |
* @param string $value |
|
16 | 1188 |
* @param mixed $deprecated Never used. |
0 | 1189 |
*/ |
1190 |
function xfn_check( $class, $value = '', $deprecated = '' ) { |
|
1191 |
global $link; |
|
1192 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1193 |
if ( ! empty( $deprecated ) ) { |
16 | 1194 |
_deprecated_argument( __FUNCTION__, '2.5.0' ); // Never implemented. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1195 |
} |
0 | 1196 |
|
1197 |
$link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: ''; |
|
9 | 1198 |
$rels = preg_split( '/\s+/', $link_rel ); |
0 | 1199 |
|
16 | 1200 |
if ( '' !== $value && in_array( $value, $rels, true ) ) { |
0 | 1201 |
echo ' checked="checked"'; |
1202 |
} |
|
1203 |
||
16 | 1204 |
if ( '' === $value ) { |
1205 |
if ( 'family' === $class && strpos( $link_rel, 'child' ) === false && strpos( $link_rel, 'parent' ) === false && strpos( $link_rel, 'sibling' ) === false && strpos( $link_rel, 'spouse' ) === false && strpos( $link_rel, 'kin' ) === false ) { |
|
9 | 1206 |
echo ' checked="checked"'; |
1207 |
} |
|
16 | 1208 |
if ( 'friendship' === $class && strpos( $link_rel, 'friend' ) === false && strpos( $link_rel, 'acquaintance' ) === false && strpos( $link_rel, 'contact' ) === false ) { |
9 | 1209 |
echo ' checked="checked"'; |
1210 |
} |
|
16 | 1211 |
if ( 'geographical' === $class && strpos( $link_rel, 'co-resident' ) === false && strpos( $link_rel, 'neighbor' ) === false ) { |
9 | 1212 |
echo ' checked="checked"'; |
1213 |
} |
|
16 | 1214 |
if ( 'identity' === $class && in_array( 'me', $rels, true ) ) { |
9 | 1215 |
echo ' checked="checked"'; |
1216 |
} |
|
0 | 1217 |
} |
1218 |
} |
|
1219 |
||
1220 |
/** |
|
1221 |
* Display xfn form fields. |
|
1222 |
* |
|
1223 |
* @since 2.6.0 |
|
1224 |
* |
|
1225 |
* @param object $link |
|
1226 |
*/ |
|
9 | 1227 |
function link_xfn_meta_box( $link ) { |
1228 |
?> |
|
5 | 1229 |
<table class="links-table"> |
0 | 1230 |
<tr> |
16 | 1231 |
<th scope="row"><label for="link_rel"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'rel:' ); ?></label></th> |
9 | 1232 |
<td><input type="text" name="link_rel" id="link_rel" value="<?php echo ( isset( $link->link_rel ) ? esc_attr( $link->link_rel ) : '' ); ?>" /></td> |
0 | 1233 |
</tr> |
1234 |
<tr> |
|
16 | 1235 |
<th scope="row"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'identity' ); ?></th> |
1236 |
<td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'identity' ); ?></span></legend> |
|
0 | 1237 |
<label for="me"> |
9 | 1238 |
<input type="checkbox" name="identity" value="me" id="me" <?php xfn_check( 'identity', 'me' ); ?> /> |
1239 |
<?php _e( 'another web address of mine' ); ?></label> |
|
0 | 1240 |
</fieldset></td> |
1241 |
</tr> |
|
1242 |
<tr> |
|
16 | 1243 |
<th scope="row"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'friendship' ); ?></th> |
1244 |
<td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'friendship' ); ?></span></legend> |
|
0 | 1245 |
<label for="contact"> |
16 | 1246 |
<input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check( 'friendship', 'contact' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'contact' ); ?> |
0 | 1247 |
</label> |
1248 |
<label for="acquaintance"> |
|
16 | 1249 |
<input class="valinp" type="radio" name="friendship" value="acquaintance" id="acquaintance" <?php xfn_check( 'friendship', 'acquaintance' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'acquaintance' ); ?> |
0 | 1250 |
</label> |
1251 |
<label for="friend"> |
|
16 | 1252 |
<input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check( 'friendship', 'friend' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'friend' ); ?> |
0 | 1253 |
</label> |
1254 |
<label for="friendship"> |
|
16 | 1255 |
<input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check( 'friendship' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'none' ); ?> |
0 | 1256 |
</label> |
1257 |
</fieldset></td> |
|
1258 |
</tr> |
|
1259 |
<tr> |
|
16 | 1260 |
<th scope="row"> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'physical' ); ?> </th> |
1261 |
<td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'physical' ); ?></span></legend> |
|
0 | 1262 |
<label for="met"> |
16 | 1263 |
<input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check( 'physical', 'met' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'met' ); ?> |
0 | 1264 |
</label> |
1265 |
</fieldset></td> |
|
1266 |
</tr> |
|
1267 |
<tr> |
|
16 | 1268 |
<th scope="row"> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'professional' ); ?> </th> |
1269 |
<td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'professional' ); ?></span></legend> |
|
0 | 1270 |
<label for="co-worker"> |
16 | 1271 |
<input class="valinp" type="checkbox" name="professional" value="co-worker" id="co-worker" <?php xfn_check( 'professional', 'co-worker' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'co-worker' ); ?> |
0 | 1272 |
</label> |
1273 |
<label for="colleague"> |
|
16 | 1274 |
<input class="valinp" type="checkbox" name="professional" value="colleague" id="colleague" <?php xfn_check( 'professional', 'colleague' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'colleague' ); ?> |
0 | 1275 |
</label> |
1276 |
</fieldset></td> |
|
1277 |
</tr> |
|
1278 |
<tr> |
|
16 | 1279 |
<th scope="row"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'geographical' ); ?></th> |
1280 |
<td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'geographical' ); ?> </span></legend> |
|
0 | 1281 |
<label for="co-resident"> |
16 | 1282 |
<input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check( 'geographical', 'co-resident' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'co-resident' ); ?> |
0 | 1283 |
</label> |
1284 |
<label for="neighbor"> |
|
16 | 1285 |
<input class="valinp" type="radio" name="geographical" value="neighbor" id="neighbor" <?php xfn_check( 'geographical', 'neighbor' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'neighbor' ); ?> |
0 | 1286 |
</label> |
1287 |
<label for="geographical"> |
|
16 | 1288 |
<input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check( 'geographical' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'none' ); ?> |
0 | 1289 |
</label> |
1290 |
</fieldset></td> |
|
1291 |
</tr> |
|
1292 |
<tr> |
|
16 | 1293 |
<th scope="row"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'family' ); ?></th> |
1294 |
<td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'family' ); ?> </span></legend> |
|
0 | 1295 |
<label for="child"> |
16 | 1296 |
<input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check( 'family', 'child' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'child' ); ?> |
0 | 1297 |
</label> |
1298 |
<label for="kin"> |
|
16 | 1299 |
<input class="valinp" type="radio" name="family" value="kin" id="kin" <?php xfn_check( 'family', 'kin' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'kin' ); ?> |
0 | 1300 |
</label> |
1301 |
<label for="parent"> |
|
16 | 1302 |
<input class="valinp" type="radio" name="family" value="parent" id="parent" <?php xfn_check( 'family', 'parent' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'parent' ); ?> |
0 | 1303 |
</label> |
1304 |
<label for="sibling"> |
|
16 | 1305 |
<input class="valinp" type="radio" name="family" value="sibling" id="sibling" <?php xfn_check( 'family', 'sibling' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'sibling' ); ?> |
0 | 1306 |
</label> |
1307 |
<label for="spouse"> |
|
16 | 1308 |
<input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check( 'family', 'spouse' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'spouse' ); ?> |
0 | 1309 |
</label> |
1310 |
<label for="family"> |
|
16 | 1311 |
<input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check( 'family' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'none' ); ?> |
0 | 1312 |
</label> |
1313 |
</fieldset></td> |
|
1314 |
</tr> |
|
1315 |
<tr> |
|
16 | 1316 |
<th scope="row"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'romantic' ); ?></th> |
1317 |
<td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'romantic' ); ?> </span></legend> |
|
0 | 1318 |
<label for="muse"> |
16 | 1319 |
<input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check( 'romantic', 'muse' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'muse' ); ?> |
0 | 1320 |
</label> |
1321 |
<label for="crush"> |
|
16 | 1322 |
<input class="valinp" type="checkbox" name="romantic" value="crush" id="crush" <?php xfn_check( 'romantic', 'crush' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'crush' ); ?> |
0 | 1323 |
</label> |
1324 |
<label for="date"> |
|
16 | 1325 |
<input class="valinp" type="checkbox" name="romantic" value="date" id="date" <?php xfn_check( 'romantic', 'date' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'date' ); ?> |
0 | 1326 |
</label> |
1327 |
<label for="romantic"> |
|
16 | 1328 |
<input class="valinp" type="checkbox" name="romantic" value="sweetheart" id="romantic" <?php xfn_check( 'romantic', 'sweetheart' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'sweetheart' ); ?> |
0 | 1329 |
</label> |
1330 |
</fieldset></td> |
|
1331 |
</tr> |
|
1332 |
||
1333 |
</table> |
|
16 | 1334 |
<p><?php _e( 'If the link is to a person, you can specify your relationship with them using the above form. If you would like to learn more about the idea check out <a href="https://gmpg.org/xfn/">XFN</a>.' ); ?></p> |
9 | 1335 |
<?php |
0 | 1336 |
} |
1337 |
||
1338 |
/** |
|
1339 |
* Display advanced link options form fields. |
|
1340 |
* |
|
1341 |
* @since 2.6.0 |
|
1342 |
* |
|
1343 |
* @param object $link |
|
1344 |
*/ |
|
9 | 1345 |
function link_advanced_meta_box( $link ) { |
1346 |
?> |
|
0 | 1347 |
<table class="links-table" cellpadding="0"> |
1348 |
<tr> |
|
9 | 1349 |
<th scope="row"><label for="link_image"><?php _e( 'Image Address' ); ?></label></th> |
1350 |
<td><input type="text" name="link_image" class="code" id="link_image" maxlength="255" value="<?php echo ( isset( $link->link_image ) ? esc_attr( $link->link_image ) : '' ); ?>" /></td> |
|
0 | 1351 |
</tr> |
1352 |
<tr> |
|
9 | 1353 |
<th scope="row"><label for="rss_uri"><?php _e( 'RSS Address' ); ?></label></th> |
1354 |
<td><input name="link_rss" class="code" type="text" id="rss_uri" maxlength="255" value="<?php echo ( isset( $link->link_rss ) ? esc_attr( $link->link_rss ) : '' ); ?>" /></td> |
|
0 | 1355 |
</tr> |
1356 |
<tr> |
|
9 | 1357 |
<th scope="row"><label for="link_notes"><?php _e( 'Notes' ); ?></label></th> |
1358 |
<td><textarea name="link_notes" id="link_notes" rows="10"><?php echo ( isset( $link->link_notes ) ? $link->link_notes : '' ); // textarea_escaped ?></textarea></td> |
|
0 | 1359 |
</tr> |
1360 |
<tr> |
|
9 | 1361 |
<th scope="row"><label for="link_rating"><?php _e( 'Rating' ); ?></label></th> |
0 | 1362 |
<td><select name="link_rating" id="link_rating" size="1"> |
1363 |
<?php |
|
16 | 1364 |
for ( $parsed_args = 0; $parsed_args <= 10; $parsed_args++ ) { |
1365 |
echo '<option value="' . $parsed_args . '"'; |
|
1366 |
if ( isset( $link->link_rating ) && $link->link_rating == $parsed_args ) { |
|
9 | 1367 |
echo ' selected="selected"'; |
0 | 1368 |
} |
16 | 1369 |
echo( '>' . $parsed_args . '</option>' ); |
9 | 1370 |
} |
1371 |
?> |
|
1372 |
</select> <?php _e( '(Leave at 0 for no rating.)' ); ?> |
|
0 | 1373 |
</td> |
1374 |
</tr> |
|
1375 |
</table> |
|
9 | 1376 |
<?php |
0 | 1377 |
} |
1378 |
||
1379 |
/** |
|
1380 |
* Display post thumbnail meta box. |
|
1381 |
* |
|
1382 |
* @since 2.9.0 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1383 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1384 |
* @param WP_Post $post A post object. |
0 | 1385 |
*/ |
1386 |
function post_thumbnail_meta_box( $post ) { |
|
1387 |
$thumbnail_id = get_post_meta( $post->ID, '_thumbnail_id', true ); |
|
1388 |
echo _wp_post_thumbnail_html( $thumbnail_id, $post->ID ); |
|
1389 |
} |
|
5 | 1390 |
|
1391 |
/** |
|
1392 |
* Display fields for ID3 data |
|
1393 |
* |
|
1394 |
* @since 3.9.0 |
|
1395 |
* |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1396 |
* @param WP_Post $post A post object. |
5 | 1397 |
*/ |
1398 |
function attachment_id3_data_meta_box( $post ) { |
|
1399 |
$meta = array(); |
|
1400 |
if ( ! empty( $post->ID ) ) { |
|
1401 |
$meta = wp_get_attachment_metadata( $post->ID ); |
|
1402 |
} |
|
1403 |
||
9 | 1404 |
foreach ( wp_get_attachment_id3_keys( $post, 'edit' ) as $key => $label ) : |
1405 |
$value = ''; |
|
1406 |
if ( ! empty( $meta[ $key ] ) ) { |
|
1407 |
$value = $meta[ $key ]; |
|
1408 |
} |
|
1409 |
?> |
|
5 | 1410 |
<p> |
9 | 1411 |
<label for="title"><?php echo $label; ?></label><br /> |
1412 |
<input type="text" name="id3_<?php echo esc_attr( $key ); ?>" id="id3_<?php echo esc_attr( $key ); ?>" class="large-text" value="<?php echo esc_attr( $value ); ?>" /> |
|
5 | 1413 |
</p> |
9 | 1414 |
<?php |
5 | 1415 |
endforeach; |
1416 |
} |
|
9 | 1417 |
|
1418 |
/** |
|
1419 |
* Registers the default post meta boxes, and runs the `do_meta_boxes` actions. |
|
1420 |
* |
|
1421 |
* @since 5.0.0 |
|
1422 |
* |
|
1423 |
* @param WP_Post $post The post object that these meta boxes are being generated for. |
|
1424 |
*/ |
|
1425 |
function register_and_do_post_meta_boxes( $post ) { |
|
1426 |
$post_type = $post->post_type; |
|
1427 |
$post_type_object = get_post_type_object( $post_type ); |
|
1428 |
||
1429 |
$thumbnail_support = current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' ); |
|
1430 |
if ( ! $thumbnail_support && 'attachment' === $post_type && $post->post_mime_type ) { |
|
1431 |
if ( wp_attachment_is( 'audio', $post ) ) { |
|
1432 |
$thumbnail_support = post_type_supports( 'attachment:audio', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:audio' ); |
|
1433 |
} elseif ( wp_attachment_is( 'video', $post ) ) { |
|
1434 |
$thumbnail_support = post_type_supports( 'attachment:video', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:video' ); |
|
1435 |
} |
|
1436 |
} |
|
1437 |
||
1438 |
$publish_callback_args = array( '__back_compat_meta_box' => true ); |
|
16 | 1439 |
|
1440 |
if ( post_type_supports( $post_type, 'revisions' ) && 'auto-draft' !== $post->post_status ) { |
|
1441 |
$revisions = wp_get_post_revisions( $post->ID, array( 'fields' => 'ids' ) ); |
|
9 | 1442 |
|
1443 |
// We should aim to show the revisions meta box only when there are revisions. |
|
1444 |
if ( count( $revisions ) > 1 ) { |
|
1445 |
$publish_callback_args = array( |
|
1446 |
'revisions_count' => count( $revisions ), |
|
16 | 1447 |
'revision_id' => reset( $revisions ), |
9 | 1448 |
'__back_compat_meta_box' => true, |
1449 |
); |
|
16 | 1450 |
|
9 | 1451 |
add_meta_box( 'revisionsdiv', __( 'Revisions' ), 'post_revisions_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); |
1452 |
} |
|
1453 |
} |
|
1454 |
||
16 | 1455 |
if ( 'attachment' === $post_type ) { |
9 | 1456 |
wp_enqueue_script( 'image-edit' ); |
1457 |
wp_enqueue_style( 'imgareaselect' ); |
|
1458 |
add_meta_box( 'submitdiv', __( 'Save' ), 'attachment_submit_meta_box', null, 'side', 'core', array( '__back_compat_meta_box' => true ) ); |
|
1459 |
add_action( 'edit_form_after_title', 'edit_form_image_editor' ); |
|
1460 |
||
1461 |
if ( wp_attachment_is( 'audio', $post ) ) { |
|
1462 |
add_meta_box( 'attachment-id3', __( 'Metadata' ), 'attachment_id3_data_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); |
|
1463 |
} |
|
1464 |
} else { |
|
1465 |
add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', null, 'side', 'core', $publish_callback_args ); |
|
1466 |
} |
|
1467 |
||
1468 |
if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) ) { |
|
1469 |
add_meta_box( 'formatdiv', _x( 'Format', 'post format' ), 'post_format_meta_box', null, 'side', 'core', array( '__back_compat_meta_box' => true ) ); |
|
1470 |
} |
|
1471 |
||
16 | 1472 |
// All taxonomies. |
9 | 1473 |
foreach ( get_object_taxonomies( $post ) as $tax_name ) { |
1474 |
$taxonomy = get_taxonomy( $tax_name ); |
|
1475 |
if ( ! $taxonomy->show_ui || false === $taxonomy->meta_box_cb ) { |
|
1476 |
continue; |
|
1477 |
} |
|
1478 |
||
1479 |
$label = $taxonomy->labels->name; |
|
1480 |
||
1481 |
if ( ! is_taxonomy_hierarchical( $tax_name ) ) { |
|
1482 |
$tax_meta_box_id = 'tagsdiv-' . $tax_name; |
|
1483 |
} else { |
|
1484 |
$tax_meta_box_id = $tax_name . 'div'; |
|
1485 |
} |
|
1486 |
||
1487 |
add_meta_box( |
|
1488 |
$tax_meta_box_id, |
|
1489 |
$label, |
|
1490 |
$taxonomy->meta_box_cb, |
|
1491 |
null, |
|
1492 |
'side', |
|
1493 |
'core', |
|
1494 |
array( |
|
1495 |
'taxonomy' => $tax_name, |
|
1496 |
'__back_compat_meta_box' => true, |
|
1497 |
) |
|
1498 |
); |
|
1499 |
} |
|
1500 |
||
1501 |
if ( post_type_supports( $post_type, 'page-attributes' ) || count( get_page_templates( $post ) ) > 0 ) { |
|
1502 |
add_meta_box( 'pageparentdiv', $post_type_object->labels->attributes, 'page_attributes_meta_box', null, 'side', 'core', array( '__back_compat_meta_box' => true ) ); |
|
1503 |
} |
|
1504 |
||
1505 |
if ( $thumbnail_support && current_user_can( 'upload_files' ) ) { |
|
1506 |
add_meta_box( 'postimagediv', esc_html( $post_type_object->labels->featured_image ), 'post_thumbnail_meta_box', null, 'side', 'low', array( '__back_compat_meta_box' => true ) ); |
|
1507 |
} |
|
1508 |
||
1509 |
if ( post_type_supports( $post_type, 'excerpt' ) ) { |
|
1510 |
add_meta_box( 'postexcerpt', __( 'Excerpt' ), 'post_excerpt_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); |
|
1511 |
} |
|
1512 |
||
1513 |
if ( post_type_supports( $post_type, 'trackbacks' ) ) { |
|
1514 |
add_meta_box( 'trackbacksdiv', __( 'Send Trackbacks' ), 'post_trackback_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); |
|
1515 |
} |
|
1516 |
||
1517 |
if ( post_type_supports( $post_type, 'custom-fields' ) ) { |
|
1518 |
add_meta_box( |
|
1519 |
'postcustom', |
|
1520 |
__( 'Custom Fields' ), |
|
1521 |
'post_custom_meta_box', |
|
1522 |
null, |
|
1523 |
'normal', |
|
1524 |
'core', |
|
1525 |
array( |
|
1526 |
'__back_compat_meta_box' => ! (bool) get_user_meta( get_current_user_id(), 'enable_custom_fields', true ), |
|
1527 |
'__block_editor_compatible_meta_box' => true, |
|
1528 |
) |
|
1529 |
); |
|
1530 |
} |
|
1531 |
||
1532 |
/** |
|
1533 |
* Fires in the middle of built-in meta box registration. |
|
1534 |
* |
|
1535 |
* @since 2.1.0 |
|
16 | 1536 |
* @deprecated 3.7.0 Use {@see 'add_meta_boxes'} instead. |
9 | 1537 |
* |
1538 |
* @param WP_Post $post Post object. |
|
1539 |
*/ |
|
16 | 1540 |
do_action_deprecated( 'dbx_post_advanced', array( $post ), '3.7.0', 'add_meta_boxes' ); |
9 | 1541 |
|
1542 |
// Allow the Discussion meta box to show up if the post type supports comments, |
|
1543 |
// or if comments or pings are open. |
|
1544 |
if ( comments_open( $post ) || pings_open( $post ) || post_type_supports( $post_type, 'comments' ) ) { |
|
1545 |
add_meta_box( 'commentstatusdiv', __( 'Discussion' ), 'post_comment_status_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); |
|
1546 |
} |
|
1547 |
||
1548 |
$stati = get_post_stati( array( 'public' => true ) ); |
|
1549 |
if ( empty( $stati ) ) { |
|
1550 |
$stati = array( 'publish' ); |
|
1551 |
} |
|
1552 |
$stati[] = 'private'; |
|
1553 |
||
16 | 1554 |
if ( in_array( get_post_status( $post ), $stati, true ) ) { |
1555 |
// If the post type support comments, or the post has comments, |
|
1556 |
// allow the Comments meta box. |
|
9 | 1557 |
if ( comments_open( $post ) || pings_open( $post ) || $post->comment_count > 0 || post_type_supports( $post_type, 'comments' ) ) { |
1558 |
add_meta_box( 'commentsdiv', __( 'Comments' ), 'post_comment_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); |
|
1559 |
} |
|
1560 |
} |
|
1561 |
||
16 | 1562 |
if ( ! ( 'pending' === get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) { |
9 | 1563 |
add_meta_box( 'slugdiv', __( 'Slug' ), 'post_slug_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); |
1564 |
} |
|
1565 |
||
1566 |
if ( post_type_supports( $post_type, 'author' ) && current_user_can( $post_type_object->cap->edit_others_posts ) ) { |
|
1567 |
add_meta_box( 'authordiv', __( 'Author' ), 'post_author_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); |
|
1568 |
} |
|
1569 |
||
1570 |
/** |
|
1571 |
* Fires after all built-in meta boxes have been added. |
|
1572 |
* |
|
1573 |
* @since 3.0.0 |
|
1574 |
* |
|
1575 |
* @param string $post_type Post type. |
|
1576 |
* @param WP_Post $post Post object. |
|
1577 |
*/ |
|
1578 |
do_action( 'add_meta_boxes', $post_type, $post ); |
|
1579 |
||
1580 |
/** |
|
1581 |
* Fires after all built-in meta boxes have been added, contextually for the given post type. |
|
1582 |
* |
|
1583 |
* The dynamic portion of the hook, `$post_type`, refers to the post type of the post. |
|
1584 |
* |
|
1585 |
* @since 3.0.0 |
|
1586 |
* |
|
1587 |
* @param WP_Post $post Post object. |
|
1588 |
*/ |
|
1589 |
do_action( "add_meta_boxes_{$post_type}", $post ); |
|
1590 |
||
1591 |
/** |
|
1592 |
* Fires after meta boxes have been added. |
|
1593 |
* |
|
1594 |
* Fires once for each of the default meta box contexts: normal, advanced, and side. |
|
1595 |
* |
|
1596 |
* @since 3.0.0 |
|
1597 |
* |
|
16 | 1598 |
* @param string $post_type Post type of the post on Edit Post screen, 'link' on Edit Link screen, |
1599 |
* 'dashboard' on Dashboard screen. |
|
1600 |
* @param string $context Meta box context. Possible values include 'normal', 'advanced', 'side'. |
|
1601 |
* @param WP_Post|object|string $post Post object on Edit Post screen, link object on Edit Link screen, |
|
1602 |
* an empty string on Dashboard screen. |
|
9 | 1603 |
*/ |
1604 |
do_action( 'do_meta_boxes', $post_type, 'normal', $post ); |
|
1605 |
/** This action is documented in wp-admin/includes/meta-boxes.php */ |
|
1606 |
do_action( 'do_meta_boxes', $post_type, 'advanced', $post ); |
|
1607 |
/** This action is documented in wp-admin/includes/meta-boxes.php */ |
|
1608 |
do_action( 'do_meta_boxes', $post_type, 'side', $post ); |
|
1609 |
} |