WordPress.org

Make WordPress Core

Ticket #11571: 11571.2.diff

File 11571.2.diff, 1.0 KB (added by scribu, 8 years ago)

cleanup

  • wp-includes/post-thumbnail-template.php

     
    7070        return apply_filters( 'post_thumbnail_html', $html, $post_id, $post_thumbnail_id, $size, $attr );
    7171}
    7272
    73 ?>
     73/**
     74 * Retrieve Post Thumbnail URL.
     75 *
     76 * @param int $post_id Optional. Post ID.
     77 * @param string $size Optional. Image size. Defaults to 'post-thumbnail'.
     78 */
     79function get_the_post_thumbnail_src( $post_id = NULL, $size = 'post-thumbnail' ) {
     80        $post_id = ( NULL === $post_id ) ? get_the_ID() : $post_id;
     81        $post_thumbnail_id = get_post_thumbnail_id( $post_id );
     82
     83        if ( $post_thumbnail_id ) {
     84                $size = apply_filters( 'post_thumbnail_size', $size );
     85                list( $src ) = wp_get_attachment_image_src( $post_thumbnail_id, $size );
     86        } else {
     87                $src = false;
     88        }
     89
     90        return apply_filters( 'post_thumbnail_src', $src, $post_id, $post_thumbnail_id, $size, $icon );
     91}
     92