Ticket #25229: post-thumbnail-template.php.diff
File post-thumbnail-template.php.diff, 2.2 KB (added by , 11 years ago) |
---|
-
post-thumbnail-template.php
85 85 function get_the_post_thumbnail( $post_id = null, $size = 'post-thumbnail', $attr = '' ) { 86 86 $post_id = ( null === $post_id ) ? get_the_ID() : $post_id; 87 87 $post_thumbnail_id = get_post_thumbnail_id( $post_id ); 88 /** 89 * Filters the post thumbnail size. 90 * 91 * @since 2.9.0 92 * 93 * @param string $size The size of a post thumbnail. 94 */ 88 95 $size = apply_filters( 'post_thumbnail_size', $size ); 89 96 if ( $post_thumbnail_id ) { 97 /** 98 * Begins to fetch the post thumbnail HTML. 99 * 100 * @since 2.9.0 101 * 102 * @param string $post_id The ID of the post where the post thumbnail will be displayed. 103 * @param string $post_thumbnail_id The ID of a post thumbnail. 104 * @param string $size The size of a post thumbnail. 105 */ 90 106 do_action( 'begin_fetch_post_thumbnail_html', $post_id, $post_thumbnail_id, $size ); // for "Just In Time" filtering of all of wp_get_attachment_image()'s filters 91 107 if ( in_the_loop() ) 92 108 update_post_thumbnail_cache(); 93 109 $html = wp_get_attachment_image( $post_thumbnail_id, $size, false, $attr ); 110 /** 111 * Stops fetching the post thumbnail HTML. 112 * 113 * @since 2.9.0 114 * 115 * @param string $post_id The ID of the post where the post thumbnail will be displayed. 116 * @param string $post_thumbnail_id The ID of a post thumbnail. 117 * @param string $size The size of a post thumbnail. 118 */ 94 119 do_action( 'end_fetch_post_thumbnail_html', $post_id, $post_thumbnail_id, $size ); 95 120 } else { 96 121 $html = ''; 97 122 } 123 /** 124 * Filters the post thumbnail HTML. 125 * 126 * @since 2.9.0 127 * 128 * @param string $html Gets the iamge attachment for the post thumbnail. 129 * @param string $post_id The ID of the post where the post thumbnail will be displayed. 130 * @param string $post_thumbnail_id The ID of a post thumbnail. 131 * @param string $size The size of a post thumbnail. 132 * @param string $attr Optional. Query string of attributes. 133 */ 98 134 return apply_filters( 'post_thumbnail_html', $html, $post_id, $post_thumbnail_id, $size, $attr ); 99 135 }