Post/Page Image was too generic a name. Post/Page Thumbnail is more clear, even if you can create very large thumbnail images if you so choose.
git-svn-id: http://svn.automattic.com/wordpress/trunk@12351 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -1410,14 +1410,14 @@ case 'set-post-thumbnail':
|
||||
|
||||
if ( $thumbnail_id == '-1' ) {
|
||||
delete_post_meta( $post_id, '_thumbnail_id' );
|
||||
die( _wp_post_image_html() );
|
||||
die( _wp_post_thumbnail_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_image_html( $thumbnail_id ) );
|
||||
die( _wp_post_thumbnail_html( $thumbnail_id ) );
|
||||
}
|
||||
}
|
||||
die( '0' );
|
||||
|
||||
@@ -98,8 +98,8 @@ 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', 'post' ) )
|
||||
add_meta_box('postimagediv', __('Post Image'), 'post_image_meta_box', 'post', 'side', 'low');
|
||||
if ( current_theme_supports( 'post-thumbnails', 'post' ) )
|
||||
add_meta_box('postimagediv', __('Post Thumbnail'), 'post_thumbnail_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');
|
||||
|
||||
@@ -80,8 +80,8 @@ add_meta_box('pageparentdiv', __('Attributes'), 'page_attributes_meta_box', 'pag
|
||||
add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', 'page', 'normal', 'core');
|
||||
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', 'page' ) )
|
||||
add_meta_box('postimagediv', __('Page Image'), 'post_image_meta_box', 'page', 'side', 'low');
|
||||
if ( current_theme_supports( 'post-thumbnails', 'page' ) )
|
||||
add_meta_box('postimagediv', __('Page Image'), 'post_thumbnail_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) )
|
||||
|
||||
@@ -75,7 +75,7 @@ function wp_crop_image( $src_file, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate post image attachment meta data.
|
||||
* Generate post thumbnail attachment meta data.
|
||||
*
|
||||
* @since 2.1.0
|
||||
*
|
||||
|
||||
@@ -1239,8 +1239,8 @@ function get_media_item( $attachment_id, $args = null ) {
|
||||
}
|
||||
|
||||
$thumbnail = '';
|
||||
if ( 'image' == $type && isset($_GET['post_id']) && current_theme_supports( 'post-images', get_post_type($_GET['post_id']) ) && get_post_image_id($_GET['post_id']) != $attachment_id )
|
||||
$thumbnail = "<a class='wp-post-thumbnail' href='#' onclick='WPSetAsThumbnail(\"$attachment_id\");return false;'>" . esc_html__( "Use as post image" ) . "</a>";
|
||||
if ( 'image' == $type && isset($_GET['post_id']) && current_theme_supports( 'post-thumbnails', get_post_type($_GET['post_id']) ) && get_post_thumbnail_id($_GET['post_id']) != $attachment_id )
|
||||
$thumbnail = "<a class='wp-post-thumbnail' href='#' onclick='WPSetAsThumbnail(\"$attachment_id\");return false;'>" . esc_html__( "Use as thumbnail" ) . "</a>";
|
||||
|
||||
if ( ( $send || $thumbnail || $delete ) && !isset($form_fields['buttons']) )
|
||||
$form_fields['buttons'] = array('tr' => "\t\t<tr class='submit'><td></td><td class='savesend'>$send $thumbnail $delete</td></tr>\n");
|
||||
|
||||
@@ -815,12 +815,12 @@ function link_advanced_meta_box($link) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Display post image meta box.
|
||||
* Display post thumbnail meta box.
|
||||
*
|
||||
* @since 2.9.0
|
||||
*/
|
||||
function post_image_meta_box() {
|
||||
function post_thumbnail_meta_box() {
|
||||
global $post;
|
||||
$thumbnail_id = get_post_meta( $post->ID, '_thumbnail_id', true );
|
||||
echo _wp_post_image_html( $thumbnail_id );
|
||||
echo _wp_post_thumbnail_html( $thumbnail_id );
|
||||
}
|
||||
|
||||
@@ -1062,32 +1062,32 @@ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Output HTML for the post image meta-box.
|
||||
* Output HTML for the post thumbnail meta-box.
|
||||
*
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @param int $thumbnail_id ID of the attachment used for thumbnail
|
||||
* @return string html
|
||||
*/
|
||||
function _wp_post_image_html( $thumbnail_id = NULL ) {
|
||||
function _wp_post_thumbnail_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 image' ) . '</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 thumbnail' ) . '</a></p>';
|
||||
|
||||
if ( $thumbnail_id && get_post( $thumbnail_id ) ) {
|
||||
$old_content_width = $content_width;
|
||||
$content_width = 266;
|
||||
if ( !isset( $_wp_additional_image_sizes['post-image'] ) )
|
||||
if ( !isset( $_wp_additional_image_sizes['post-thumbnail'] ) )
|
||||
$thumbnail_html = wp_get_attachment_image( $thumbnail_id, array( $content_width, $content_width ) );
|
||||
else
|
||||
$thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'post-image' );
|
||||
$thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'post-thumbnail' );
|
||||
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 image' ) . '</a></p>';
|
||||
$content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail();return false;">' . esc_html__( 'Remove thumbnail' ) . '</a></p>';
|
||||
}
|
||||
$content_width = $old_content_width;
|
||||
}
|
||||
|
||||
return apply_filters( 'admin_post_image_html', $content );
|
||||
return apply_filters( 'admin_post_thumbnail_html', $content );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user