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