Display Post/Page Thumbnail meta box even if theme does not support it -- just display an info message. props janeforshort
git-svn-id: http://svn.automattic.com/wordpress/trunk@12322 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
92a8421c69
commit
8b8dbd3205
|
@ -98,8 +98,7 @@ foreach ( get_object_taxonomies('post') as $tax_name ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', 'post', 'side', 'core');
|
add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', 'post', 'side', 'core');
|
||||||
if ( current_theme_supports( 'post-thumbnails' ) )
|
add_meta_box('postthumbnaildiv', __('Post Thumbnail'), 'post_thumbnail_meta_box', 'post', 'side', 'low');
|
||||||
add_meta_box('postthumbnaildiv', __('Post Thumbnail'), 'post_thumbnail_meta_box', 'post', 'side', 'low');
|
|
||||||
add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', 'post', 'normal', 'core');
|
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('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', 'post', 'normal', 'core');
|
||||||
add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', 'post', 'normal', 'core');
|
add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', 'post', 'normal', 'core');
|
||||||
|
|
|
@ -80,8 +80,7 @@ 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('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('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', 'page', 'normal', 'core');
|
||||||
add_meta_box('slugdiv', __('Page Slug'), 'post_slug_meta_box', 'page', 'normal', 'core');
|
add_meta_box('slugdiv', __('Page Slug'), 'post_slug_meta_box', 'page', 'normal', 'core');
|
||||||
if ( current_theme_supports( 'post-thumbnails' ) )
|
add_meta_box('postthumbnaildiv', __('Page Thumbnail'), 'post_thumbnail_meta_box', 'page', 'side', 'low');
|
||||||
add_meta_box('postthumbnaildiv', __('Page Thumbnail'), 'post_thumbnail_meta_box', 'page', 'side', 'low');
|
|
||||||
|
|
||||||
$authors = get_editable_user_ids( $current_user->id, true, 'page' ); // TODO: ROLE SYSTEM
|
$authors = get_editable_user_ids( $current_user->id, true, 'page' ); // TODO: ROLE SYSTEM
|
||||||
if ( $post->post_author && !in_array($post->post_author, $authors) )
|
if ( $post->post_author && !in_array($post->post_author, $authors) )
|
||||||
|
|
|
@ -1068,6 +1068,17 @@ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
|
||||||
* @return string html
|
* @return string html
|
||||||
*/
|
*/
|
||||||
function _wp_post_thumbnail_html( $thumbnail_id = NULL ) {
|
function _wp_post_thumbnail_html( $thumbnail_id = NULL ) {
|
||||||
|
global $post;
|
||||||
|
if ( !current_theme_supports( 'post-thumbnails' ) ) {
|
||||||
|
if ( 'post' == $post->post_type ) {
|
||||||
|
$type = __( 'post' );
|
||||||
|
} elseif ( 'page' == $post->post_type ) {
|
||||||
|
$type = __( 'page' );
|
||||||
|
} else {
|
||||||
|
$type = $post->post_type;
|
||||||
|
}
|
||||||
|
return sprintf( __( '<p>Your theme does not currently support <a href="%1$s">%2$s thumbnails</a>.</p><p>You can hide this module by clicking the "Screen Options" tab.</p>' ), _x( 'http://codex.wordpress.org/Post_Images', 'Within the post/page thumbnail module on the post/page edit screen' ), $type );
|
||||||
|
}
|
||||||
$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 thumbnail' ) . '</a></p>';
|
||||||
|
|
||||||
if ( $thumbnail_id && get_post( $thumbnail_id ) ) {
|
if ( $thumbnail_id && get_post( $thumbnail_id ) ) {
|
||||||
|
|
Loading…
Reference in New Issue