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/post-template.php

    r12019 r12035  
    910910}
    911911
    912 function the_post_image( $size = 'thumbnail' ) {
    913     echo get_the_post_image( $size );
    914 }
    915 
    916 function get_the_post_image( $size = 'thumbnail', $post_id = NULL ) {
     912function the_post_image( $size = 'thumbnail', $attr = '' ) {
     913    echo get_the_post_image( NULL, $size, $attr );
     914}
     915
     916function get_the_post_image( $post_id = NULL, $size = 'thumbnail', $attr = '' ) {
    917917    global $id;
    918918    $post_id = ( NULL === $post_id ) ? $id : $post_id;
     
    921921    if ( $post_image_id ) {
    922922        do_action( 'begin_fetch_post_image_html', $post_id, $post_image_id, $size ); // for "Just In Time" filtering of all of wp_get_attachment_image()'s filters
    923         $html = wp_get_attachment_image( $post_image_id, $size );
     923        $html = wp_get_attachment_image( $post_image_id, $size, false, $attr );
    924924        do_action( 'end_fetch_post_image_html', $post_id, $post_image_id, $size );
    925925    } else {
Note: See TracChangeset for help on using the changeset viewer.