Advertisements

wp_post_revision_title

Definition:
function wp_post_revision_title( $revision, $link = true ) {}

Retrieve formatted date timestamp of a revision (linked to that revisions’s page).

Parameters

  • int|object $revision: Revision ID or revision object.
  • bool $link: Optional, default is true. Link to revisions’s page?

Return values

returns:i18n formatted datetimestamp or localized ‘Current Revision’.

Source code

function wp_post_revision_title( $revision, $link = true ) {

	if ( !$revision = get_post( $revision ) )

		return $revision;



	if ( !in_array( $revision->post_type, array( 'post', 'page', 'revision' ) ) )

		return false;



	/* translators: revision date format, see http://php.net/date */

	$datef = _x( 'j F, Y @ G:i', 'revision date format');

	/* translators: 1: date */

	$autosavef = __( '%1$s [Autosave]' );

	/* translators: 1: date */

	$currentf  = __( '%1$s [Current Revision]' );



	$date = date_i18n( $datef, strtotime( $revision->post_modified ) );

	if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) )

		$date = "<a href='$link'>$date</a>";



	if ( !wp_is_post_revision( $revision ) )

		$date = sprintf( $currentf, $date );

	elseif ( wp_is_post_autosave( $revision ) )

		$date = sprintf( $autosavef, $date );



	return $date;

}

3991

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: