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