Make WordPress Core

Ticket #37186: 37186.diff

File 37186.diff, 3.0 KB (added by helen, 7 years ago)
  • src/wp-admin/includes/class-wp-media-list-table.php

     
    474474                }
    475475
    476476                if ( $parent ) {
    477                         $title = _draft_or_post_title( $post->post_parent );
    478477                        $parent_type = get_post_type_object( $parent->post_type );
     478                       
     479                        if ( $parent_type && $parent_type->show_ui && current_user_can( 'edit_post', $post->post_parent ) ) {
     480                                $title = _draft_or_post_title( $post->post_parent );
    479481?>
    480                         <strong>
    481                         <?php if ( $parent_type && $parent_type->show_ui && current_user_can( 'edit_post', $post->post_parent ) ) { ?>
    482                                 <a href="<?php echo get_edit_post_link( $post->post_parent ); ?>">
    483                                         <?php echo $title ?></a><?php
     482                                <strong><a href="<?php echo get_edit_post_link( $post->post_parent ); ?>">
     483                                        <?php echo $title ?></a></strong><?php
    484484                        } else {
    485                                 echo $title;
    486                         } ?></strong>
    487                         <br />
    488                         <?php
     485                                _e( '(Private post)' );
     486                        }
     487
    489488                        if ( $user_can_edit ):
    490489                                $detach_url = add_query_arg( array(
    491490                                        'parent_post_id' => $post->post_parent,
     
    493492                                        '_wpnonce' => wp_create_nonce( 'bulk-' . $this->_args['plural'] )
    494493                                ), 'upload.php' );
    495494                                printf(
    496                                         '<a href="%s" class="hide-if-no-js detach-from-parent" aria-label="%s">%s</a>',
     495                                        '<br /><a href="%s" class="hide-if-no-js detach-from-parent" aria-label="%s">%s</a>',
    497496                                        $detach_url,
    498497                                        /* translators: %s: title of the post the attachment is attached to */
    499498                                        esc_attr( sprintf( __( 'Detach from &#8220;%s&#8221;' ), $title ) ),
     
    501500                                );
    502501                        endif;
    503502                } else {
    504                         _e( '(Unattached)' ); ?><br />
     503                        _e( '(Unattached)' ); ?>
    505504                        <?php if ( $user_can_edit ) {
    506505                                $title = _draft_or_post_title( $post->post_parent );
    507506                                printf(
    508                                         '<a href="#the-list" onclick="findPosts.open( \'media[]\', \'%s\' ); return false;" class="hide-if-no-js" aria-label="%s">%s</a>',
     507                                        '<br /><a href="#the-list" onclick="findPosts.open( \'media[]\', \'%s\' ); return false;" class="hide-if-no-js" aria-label="%s">%s</a>',
    509508                                        $post->ID,
    510509                                        /* translators: %s: attachment title */
    511510                                        esc_attr( sprintf( __( 'Attach &#8220;%s&#8221; to existing content' ), $title ) ),
  • src/wp-includes/media.php

     
    30643064                $parent_type = get_post_type_object( $post_parent->post_type );
    30653065                if ( $parent_type && $parent_type->show_ui && current_user_can( 'edit_post', $attachment->post_parent ) ) {
    30663066                        $response['uploadedToLink'] = get_edit_post_link( $attachment->post_parent, 'raw' );
     3067                        $response['uploadedToTitle'] = $post_parent->post_title ? $post_parent->post_title : __( '(no title)' );
    30673068                }
    3068                 $response['uploadedToTitle'] = $post_parent->post_title ? $post_parent->post_title : __( '(no title)' );
    30693069        }
    30703070
    30713071        $attached_file = get_attached_file( $attachment->ID );