More standardization around Post/Page Image instead of Post/Page Thumbnail
git-svn-id: http://svn.automattic.com/wordpress/trunk@12343 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
dc8492b9f5
commit
f74935eb92
|
@ -1410,14 +1410,14 @@ case 'set-post-thumbnail':
|
|||
|
||||
if ( $thumbnail_id == '-1' ) {
|
||||
delete_post_meta( $post_id, '_thumbnail_id' );
|
||||
die( _wp_post_thumbnail_html() );
|
||||
die( _wp_post_image_html() );
|
||||
}
|
||||
|
||||
if ( $thumbnail_id && get_post( $thumbnail_id ) ) {
|
||||
$thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'thumbnail' );
|
||||
if ( !empty( $thumbnail_html ) ) {
|
||||
update_post_meta( $post_id, '_thumbnail_id', $thumbnail_id );
|
||||
die( _wp_post_thumbnail_html( $thumbnail_id ) );
|
||||
die( _wp_post_image_html( $thumbnail_id ) );
|
||||
}
|
||||
}
|
||||
die( '0' );
|
||||
|
|
|
@ -99,7 +99,7 @@ foreach ( get_object_taxonomies('post') as $tax_name ) {
|
|||
|
||||
add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', 'post', 'side', 'core');
|
||||
if ( current_theme_supports( 'post-images' ) )
|
||||
add_meta_box('postimagediv', __('Post Thumbnail'), 'post_thumbnail_meta_box', 'post', 'side', 'low');
|
||||
add_meta_box('postimagediv', __('Post Image'), 'post_image_meta_box', 'post', 'side', 'low');
|
||||
add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', 'post', 'normal', 'core');
|
||||
add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', 'post', 'normal', 'core');
|
||||
add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', 'post', 'normal', 'core');
|
||||
|
|
|
@ -81,7 +81,7 @@ add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', 'page',
|
|||
add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', 'page', 'normal', 'core');
|
||||
add_meta_box('slugdiv', __('Page Slug'), 'post_slug_meta_box', 'page', 'normal', 'core');
|
||||
if ( current_theme_supports( 'post-images' ) )
|
||||
add_meta_box('postimagediv', __('Page Thumbnail'), 'post_thumbnail_meta_box', 'page', 'side', 'low');
|
||||
add_meta_box('postimagediv', __('Page Image'), 'post_image_meta_box', 'page', 'side', 'low');
|
||||
|
||||
$authors = get_editable_user_ids( $current_user->id, true, 'page' ); // TODO: ROLE SYSTEM
|
||||
if ( $post->post_author && !in_array($post->post_author, $authors) )
|
||||
|
|
|
@ -815,12 +815,12 @@ function link_advanced_meta_box($link) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Display post thumbnail meta box.
|
||||
* Display post image meta box.
|
||||
*
|
||||
* @since 2.9.0
|
||||
*/
|
||||
function post_thumbnail_meta_box() {
|
||||
function post_image_meta_box() {
|
||||
global $post;
|
||||
$thumbnail_id = get_post_meta( $post->ID, '_thumbnail_id', true );
|
||||
echo _wp_post_thumbnail_html( $thumbnail_id );
|
||||
echo _wp_post_image_html( $thumbnail_id );
|
||||
}
|
||||
|
|
|
@ -1062,16 +1062,16 @@ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Output HTML for the post thumbnail meta-box.
|
||||
* Output HTML for the post image meta-box.
|
||||
*
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @param int $thumbnail_id ID of the attachment used for thumbnail
|
||||
* @return string html
|
||||
*/
|
||||
function _wp_post_thumbnail_html( $thumbnail_id = NULL ) {
|
||||
function _wp_post_image_html( $thumbnail_id = NULL ) {
|
||||
global $content_width, $_wp_additional_image_sizes;
|
||||
$content = '<p class="hide-if-no-js"><a href="#" id="set-post-thumbnail" onclick="jQuery(\'#add_image\').click();return false;">' . esc_html__( 'Set thumbnail' ) . '</a></p>';
|
||||
$content = '<p class="hide-if-no-js"><a href="#" id="set-post-thumbnail" onclick="jQuery(\'#add_image\').click();return false;">' . esc_html__( 'Set image' ) . '</a></p>';
|
||||
|
||||
if ( $thumbnail_id && get_post( $thumbnail_id ) ) {
|
||||
$old_content_width = $content_width;
|
||||
|
@ -1082,12 +1082,12 @@ function _wp_post_thumbnail_html( $thumbnail_id = NULL ) {
|
|||
$thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'post-image' );
|
||||
if ( !empty( $thumbnail_html ) ) {
|
||||
$content = '<a href="#" id="set-post-thumbnail" onclick="jQuery(\'#add_image\').click();return false;">' . $thumbnail_html . '</a>';
|
||||
$content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail();return false;">' . esc_html__( 'Remove thumbnail' ) . '</a></p>';
|
||||
$content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail();return false;">' . esc_html__( 'Remove image' ) . '</a></p>';
|
||||
}
|
||||
$content_width = $old_content_width;
|
||||
}
|
||||
|
||||
return apply_filters( 'admin_post_thumbnail_html', $content );
|
||||
return apply_filters( 'admin_post_image_html', $content );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue