Preview for both drafts and published posts/pages

git-svn-id: https://develop.svn.wordpress.org/trunk@9451 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz
2008-10-31 22:47:07 +00:00
parent faf3019a0b
commit 78b8de31b6
11 changed files with 154 additions and 9 deletions
+22
View File
@@ -3551,3 +3551,25 @@ function wp_get_post_revisions( $post_id = 0, $args = null ) {
return array();
return $revisions;
}
function _show_post_preview() {
if ( isset($_GET['wp_preview']) && isset($_GET['preview_nonce']) ) {
$post_ID = (int) $_GET['wp_preview'];
if ( false == wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . $post_ID ) )
wp_die( __('You do not have permission to preview drafts.') );
$q = array(
'name' => "{$post_ID}-autosave",
'post_parent' => $post_ID,
'post_type' => 'revision',
'post_status' => 'inherit'
);
add_action( 'parse_query', '_wp_get_post_autosave_hack' );
query_posts($q);
remove_action( 'parse_query', '_wp_get_post_autosave_hack' );
}
}