Make WordPress Core


Ignore:
Timestamp:
10/15/2009 12:31:48 PM (15 years ago)
Author:
markjaquith
Message:

Allow theme devs to change attrs (like CSS class) of thumbnail images. props scribu. see #10928

File:
1 edited

Legend:

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

    r12027 r12035  
    528528 * @return string HTML img element or empty string on failure.
    529529 */
    530 function wp_get_attachment_image($attachment_id, $size = 'thumbnail', $icon = false) {
     530function wp_get_attachment_image($attachment_id, $size = 'thumbnail', $icon = false, $attr = '') {
    531531
    532532    $html = '';
     
    538538            $size = join('x', $size);
    539539        $attachment =& get_post($attachment_id);
    540         $attr = array(
     540        $default_attr = array(
    541541            'src'   => $src,
    542542            'class' => "attachment-$size",
    543543            'alt'   => trim(strip_tags( $attachment->post_excerpt )),
    544544            'title' => trim(strip_tags( $attachment->post_title )),
    545             );
     545        );
     546        $attr = wp_parse_args($attr, $default_attr);
    546547        $attr = apply_filters( 'wp_get_attachment_image_attributes', $attr, $attachment );
    547548        $attr = array_map( 'esc_attr', $attr );
Note: See TracChangeset for help on using the changeset viewer.