Ticket #28350: 28350.4.patch
File 28350.4.patch, 2.8 KB (added by , 10 years ago) |
---|
-
src/wp-admin/includes/post.php
1179 1179 1180 1180 if ( current_user_can( 'read_post', $post->ID ) ) { 1181 1181 $ptype = get_post_type_object( $post->post_type ); 1182 $view_post = $ptype->labels->view_item; 1182 if( 'draft' == $post->post_status ) { 1183 $view_post = __( 'Preview' ); 1184 } else { 1185 $view_post = $ptype->labels->view_item; 1186 } 1183 1187 } 1184 1188 1185 1189 if ( 'publish' == get_post_status( $post ) ) { … … 1234 1238 $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n"; 1235 1239 1236 1240 if ( isset( $view_post ) ) { 1237 $return .= "<span id='view-post-btn'><a href='" . get_permalink( $post ) . "' class='button button-small'>$view_post</a></span>\n"; 1241 if( 'draft' == $post->post_status ) { 1242 $preview_link = set_url_scheme( get_permalink( $post->ID ) ); 1243 /** This filter is documented in wp-admin/includes/meta-boxes.php */ 1244 $preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ) ); 1245 $return .= "<span id='view-post-btn'><a href='" . esc_url( $preview_link ) . "' class='button button-small' target='wp-preview-{$post->ID}'>$view_post</a></span>\n"; 1246 } else { 1247 $return .= "<span id='view-post-btn'><a href='" . get_permalink( $post ) . "' class='button button-small'>$view_post</a></span>\n"; 1248 } 1238 1249 } 1239 1250 1240 1251 /** This filter is documented in wp-admin/includes/post.php */ -
src/wp-includes/admin-bar.php
493 493 && ( $post_type_object->public ) 494 494 && ( $post_type_object->show_in_admin_bar ) ) 495 495 { 496 $wp_admin_bar->add_menu( array( 497 'id' => 'view', 498 'title' => $post_type_object->labels->view_item, 499 'href' => get_permalink( $post->ID ) 500 ) ); 496 if( 'draft' == $post->post_status ) { 497 $preview_link = set_url_scheme( get_permalink( $post->ID ) ); 498 /** This filter is documented in wp-admin/includes/meta-boxes.php */ 499 $preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ) ); 500 $wp_admin_bar->add_menu( array( 501 'id' => 'preview', 502 'title' => __( 'Preview' ), 503 'href' => esc_url( $preview_link ), 504 'meta' => array( 'target' => 'wp-preview-' . $post->ID ), 505 ) ); 506 } else { 507 $wp_admin_bar->add_menu( array( 508 'id' => 'view', 509 'title' => $post_type_object->labels->view_item, 510 'href' => get_permalink( $post->ID ) 511 ) ); 512 } 501 513 } elseif ( 'edit-tags' == $current_screen->base 502 514 && isset( $tag ) && is_object( $tag ) 503 515 && ( $tax = get_taxonomy( $tag->taxonomy ) )