mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-05 15:16:59 +00:00
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:
@@ -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 = '';
|
||||
|
||||
Reference in New Issue
Block a user