post_submit_meta_box() - WordPress 函数参考中文文档

返回介绍

post_submit_meta_box()

发布于 2017-09-11 字数5399 浏览 868 评论 0

post_submit_meta_box( WP_Post $post,  array $args = array() )

Displays post submit form fields.


描述


参数

$post

(WP_Post)
(Required)
Current post object.

$args

(array)
(Optional)
Array of arguments for building the post submit meta box.

  • ‘id’
    (string) Meta box ‘id’ attribute.
  • ‘title’
    (string) Meta box title.
  • ‘callback’
    (callable) Meta box display callback.
  • ‘args’
    (array) Extra meta box arguments.

Default value: array()


源代码

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

function post_submit_meta_box( $post, $args = array() ) {
	global $action;

	$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 ( 'publish' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status ) { ?>
<input <?php if ( 'private' == $post->post_status ) { ?>style="display:none"<?php } ?> 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 window)' )
);
?>
<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>
<input type="hidden" name="wp-preview" id="wp-preview" value="" />
</div>
<?php endif; // public post type ?>
<?php
/**
 * Fires before the post time/date setting 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><!--

更新日志

Version 描述
2.7.0 Introduced.

相关函数

Uses

  • wp-includes/link-template.php:
    get_preview_post_link()
  • wp-includes/post.php:
    is_post_type_viewable()
  • wp-admin/includes/meta-boxes.php:
    post_submitbox_minor_actions
  • wp-admin/includes/template.php:
    submit_button()
  • wp-admin/includes/template.php:
    touch_time()
  • wp-admin/includes/meta-boxes.php:
    post_submitbox_misc_actions
  • wp-admin/includes/meta-boxes.php:
    post_submitbox_start
  • wp-includes/capabilities.php:
    current_user_can()
  • wp-includes/l10n.php:
    __()
  • wp-includes/l10n.php:
    esc_attr_e()
  • wp-includes/l10n.php:
    _e()
  • wp-includes/l10n.php:
    _ex()
  • wp-includes/formatting.php:
    esc_url()
  • wp-includes/formatting.php:
    esc_attr()
  • wp-includes/formatting.php:
    esc_html()
  • wp-includes/general-template.php:
    selected()
  • wp-includes/general-template.php:
    checked()
  • wp-includes/functions.php:
    date_i18n()
  • wp-includes/functions.php:
    number_format_i18n()
  • wp-includes/functions.php:
    current_time()
  • wp-includes/link-template.php:
    get_edit_post_link()
  • wp-includes/link-template.php:
    get_delete_post_link()
  • wp-includes/plugin.php:
    do_action()
  • wp-includes/post.php:
    is_sticky()
  • wp-includes/post.php:
    get_post_type_object()
  • Show 20 more uses
    Hide more uses


User Contributed Notes

上一篇:post_slug_meta_box()

下一篇:post_tags_meta_box()

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!