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

git-svn-id: https://develop.svn.wordpress.org/trunk@12035 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith
2009-10-15 12:31:48 +00:00
parent da87e95962
commit 45b4ea5807
2 changed files with 8 additions and 7 deletions
+4 -4
View File
@@ -909,18 +909,18 @@ function get_post_image_id( $post_id = NULL ) {
return get_post_meta( $post_id, '_thumbnail_id', true );
}
function the_post_image( $size = 'thumbnail' ) {
echo get_the_post_image( $size );
function the_post_image( $size = 'thumbnail', $attr = '' ) {
echo get_the_post_image( NULL, $size, $attr );
}
function get_the_post_image( $size = 'thumbnail', $post_id = NULL ) {
function get_the_post_image( $post_id = NULL, $size = 'thumbnail', $attr = '' ) {
global $id;
$post_id = ( NULL === $post_id ) ? $id : $post_id;
$post_image_id = get_post_image_id( $post_id );
$size = apply_filters( 'post_image_size', $size );
if ( $post_image_id ) {
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
$html = wp_get_attachment_image( $post_image_id, $size );
$html = wp_get_attachment_image( $post_image_id, $size, false, $attr );
do_action( 'end_fetch_post_image_html', $post_id, $post_image_id, $size );
} else {
$html = '';