wp_post_revision_title
函数
wp_post_revision_title ( $revision, $link = true )
- 参数
-
-
(int|object)
$revision
Revision ID or revision object.- Required: 是
-
(bool)
$link
Optional. Whether to link to revision’s page. Default true.- Required: 否
- Default: true
-
(int|object)
- 返回值
-
- (string|false) i18n formatted datetimestamp or localized ‘Current Revision’.
- 定义位置
-
-
wp-includes/post-template.php
, line 1847
-
wp-includes/post-template.php
- 引入
- 2.6.0
- 弃用
- –
Retrieves formatted date timestamp of a revision (linked to that revisions’s page).
function wp_post_revision_title( $revision, $link = true ) { $revision = get_post( $revision ); if ( ! $revision ) { return $revision; } if ( ! in_array( $revision->post_type, array( 'post', 'page', 'revision' ), true ) ) { return false; } /* translators: Revision date format, see https://www.php.net/manual/datetime.format.php */ $datef = _x( 'F j, Y @ H:i:s', 'revision date format' ); /* translators: %s: Revision date. */ $autosavef = __( '%s [Autosave]' ); /* translators: %s: Revision date. */ $currentf = __( '%s [Current Revision]' ); $date = date_i18n( $datef, strtotime( $revision->post_modified ) ); $edit_link = get_edit_post_link( $revision->ID ); if ( $link && current_user_can( 'edit_post', $revision->ID ) && $edit_link ) { $date = "$date"; } if ( ! wp_is_post_revision( $revision ) ) { $date = sprintf( $currentf, $date ); } elseif ( wp_is_post_autosave( $revision ) ) { $date = sprintf( $autosavef, $date ); } return $date; }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。