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