post_submit_meta_box() – Displays post submit form fields.

You appear to be a bot. Output may be restricted

Description

Displays post submit form fields.

Usage

post_submit_meta_box( $post, $args );

Parameters

$post
( WP_Post ) required – Current post object.
$args
( array ) optional – { Array of arguments for building the post submit meta box.
$id
( string ) optional – Meta box 'id' attribute.
$title
( string ) optional – Meta box title.
$callback
( callable ) optional – Meta box display callback.
$args
( array ) optional – Extra meta box arguments. }

Returns

void

Source

File name: wordpress/wp-admin/includes/meta-boxes.php


Lines:

1 to 100 of 360
function post_submit_meta_box( $post, $args = array() ) {
  global $action;

  $post_id          = (int) $post->ID;
  $post_type        = $post->post_type;
  $post_type_object = get_post_type_object( $post_type );
  $can_publish      = current_user_can( $post_type_object->cap->publish_posts );
  ?>
<div class="submitbox" id="submitpost">

<div id="minor-publishing">

	<?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key. ?>
	<div style="display:none;">
		<?php submit_button( __( 'Save' ), '', 'save' ); ?>
	</div>

	<div id="minor-publishing-actions">
		<div id="save-action">
			<?php
      if ( ! in_array( $post->post_status, array( 'publish', 'future', 'pending' ), true ) ) {
        $private_style = '';
        if ( 'private' === $post->post_status ) {
          $private_style = 'style="display:none"';
        }
        ?>
				<input <?php echo $private_style; ?> type="submit" name="save" id="save-post" value="<?php esc_attr_e( 'Save Draft' ); ?>" class="button" />
				<span class="spinner"></span>
			<?php } elseif ( 'pending' === $post->post_status && $can_publish ) { ?>
				<input type="submit" name="save" id="save-post" value="<?php esc_attr_e( 'Save as Pending' ); ?>" class="button" />
				<span class="spinner"></span>
			<?php } ?>
		</div>

		<?php
    if ( is_post_type_viewable( $post_type_object ) ) :
      ?>
			<div id="preview-action">
				<?php
        $preview_link = esc_url( get_preview_post_link( $post ) );
        if ( 'publish' === $post->post_status ) {
          $preview_button_text = __( 'Preview Changes' );
        } else {
          $preview_button_text = __( 'Preview' );
        }

        $preview_button = sprintf(
          '%1$s<span class="screen-reader-text"> %2$s</span>',
          $preview_button_text,
          /* translators: Accessibility text. */
          __( '(opens in a new tab)' )
        );
        ?>
				<a class="preview button" href="<?php echo $preview_link; ?>" target="wp-preview-<?php echo $post_id; ?>" id="post-preview"><?php echo $preview_button; ?></a>
				<input type="hidden" name="wp-preview" id="wp-preview" value="" />
			</div>
			<?php
    endif;

    
/**
 * Fires after the Save Draft (or Save as Pending) and Preview (or Preview Changes) buttons
 * in the Publish meta box.
 *
 * @since 4.4.0
 *
 * @param WP_Post $post WP_Post object for the current post.
 */
    do_action( 'post_submitbox_minor_actions', $post );
    ?>
		<div class="clear"></div>
	</div>

	<div id="misc-publishing-actions">
		<div class="misc-pub-section misc-pub-post-status">
			<?php _e( 'Status:' ); ?>
			<span id="post-status-display">
				<?php
        switch ( $post->post_status ) {
          case 'private':
            _e( 'Privately Published' );
            break;
          case 'publish':
            _e( 'Published' );
            break;
          case 'future':
            _e( 'Scheduled' );
            break;
          case 'pending':
            _e( 'Pending Review' );
            break;
          case 'draft':
          case 'auto-draft':
            _e( 'Draft' );
            break;
        }
        ?>
			</span>

			<?php
      if ( 'publish' === $post->post_status || 'private' === $post->post_status || $can_publish ) {

 View on GitHub View on Trac