Make WordPress Core

Changeset 12352


Ignore:
Timestamp:
12/10/2009 07:04:01 AM (15 years ago)
Author:
markjaquith
Message:

Do not show "Use as thumbnail" in standalone media browser, but DO show it when you upload a new image on a post. fixes #11366

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/media.php

    r12351 r12352  
    12401240
    12411241    $thumbnail = '';
    1242     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 )
     1242    $calling_post_id = 0;
     1243    if ( isset( $_GET['post_id'] ) )
     1244        $calling_post_id = $_GET['post_id'];
     1245    elseif ( isset( $_POST ) && count( $_POST ) ) // Like for async-upload where $_GET['post_id'] isn't set
     1246        $calling_post_id = $post->post_parent;
     1247    if ( 'image' == $type && $calling_post_id && current_theme_supports( 'post-thumbnails', get_post_type( $calling_post_id ) ) && get_post_thumbnail_id( $calling_post_id ) != $attachment_id )
    12431248        $thumbnail = "<a class='wp-post-thumbnail' href='#' onclick='WPSetAsThumbnail(\"$attachment_id\");return false;'>" . esc_html__( "Use as thumbnail" ) . "</a>";
    12441249
Note: See TracChangeset for help on using the changeset viewer.