WordPress.org

Make WordPress Core

Ticket #11571: 11571.diff

File 11571.diff, 1.1 KB (added by wojtek.szkutnik, 9 years ago)
  • wp-includes/post-thumbnail-template.php

     
    7373        return apply_filters( 'post_thumbnail_html', $html, $post_id, $post_thumbnail_id, $size, $attr );
    7474}
    7575
     76/**
     77 * Retrieve Post Thumbnail Data.
     78 *
     79 *
     80 * @param int $post_id Optional. Post ID.
     81 * @param string $size Optional. Image size.  Defaults to 'thumbnail'.
     82 * @param bool $icon Optional, default is false. Whether it is an icon.
     83 */
     84function get_the_post_thumbnail_src( $post_id = NULL, $size = 'post-thumbnail', $icon = false ) {
     85        global $id;
     86        $post_id = ( NULL === $post_id ) ? $id : $post_id;
     87        $post_thumbnail_id = get_post_thumbnail_id( $post_id );
     88        $size = apply_filters( 'post_thumbnail_size', $size );
     89        if ( $post_thumbnail_id ) {
     90                list($src) = wp_get_attachment_image_src( $post_thumbnail_id, $size, $icon );
     91        } else {
     92                $src = false;   
     93        }
     94        return apply_filters( 'post_thumbnail_src', $src, $post_id, $post_thumbnail_id, $size, $icon );
     95}
     96
    7697?>
     98 No newline at end of file