WordPress.org

Make WordPress Core

Changeset 38831


Ignore:
Timestamp:
10/19/2016 11:02:58 PM (19 months ago)
Author:
johnbillion
Message:

Customize: Improve the labelling of background and header images in the list mode of the media library.

Props deltafactory, coreymcollins, desrosj
Fixes #22857

File:
1 edited

Legend:

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

    r38705 r38831  
    17531753    if ( current_theme_supports( 'custom-header') ) {
    17541754        $meta_header = get_post_meta($post->ID, '_wp_attachment_is_custom_header', true );
    1755         if ( ! empty( $meta_header ) && $meta_header == $stylesheet )
    1756             $media_states[] = __( 'Header Image' );
     1755
     1756        if ( is_random_header_image() ) {
     1757            $header_images = wp_list_pluck( get_uploaded_header_images(), 'attachment_id' );
     1758
     1759            if ( $meta_header == $stylesheet && in_array( $post->ID, $header_images ) ) {
     1760                $media_states[] = __( 'Header Image' );
     1761            }
     1762        } else {
     1763            $header_image = get_header_image();
     1764
     1765            // Display "Header Image" if the image was ever used as a header image
     1766            if ( ! empty( $meta_header ) && $meta_header == $stylesheet && $header_image !== wp_get_attachment_url( $post->ID ) ) {
     1767                $media_states[] = __( 'Header Image' );
     1768            }
     1769
     1770            // Display "Current Header Image" if the image is currently the header image
     1771            if ( $header_image && $header_image == wp_get_attachment_url( $post->ID ) ) {
     1772                $media_states[] = __( 'Current Header Image' );
     1773            }
     1774        }
    17571775    }
    17581776
    17591777    if ( current_theme_supports( 'custom-background') ) {
    17601778        $meta_background = get_post_meta($post->ID, '_wp_attachment_is_custom_background', true );
    1761         if ( ! empty( $meta_background ) && $meta_background == $stylesheet )
     1779
     1780        if ( ! empty( $meta_background ) && $meta_background == $stylesheet ) {
    17621781            $media_states[] = __( 'Background Image' );
     1782
     1783            $background_image = get_background_image();
     1784            if ( $background_image && $background_image == wp_get_attachment_url( $post->ID ) ) {
     1785                $media_states[] = __( 'Current Background Image' );
     1786            }
     1787        }
    17631788    }
    17641789
Note: See TracChangeset for help on using the changeset viewer.