[wp-trac] [WordPress Trac] #11571: Provide easy way to return url of thumbnail image

WordPress Trac wp-trac at lists.automattic.com
Mon Mar 22 23:02:37 UTC 2010


#11571: Provide easy way to return url of thumbnail image
-----------------------------+----------------------------------------------
 Reporter:  braindrain       |       Owner:                   
     Type:  feature request  |      Status:  new              
 Priority:  normal           |   Milestone:  3.1              
Component:  Post Thumbnails  |     Version:  2.9              
 Severity:  normal           |    Keywords:  reporter-feedback
-----------------------------+----------------------------------------------
Changes (by mikeschinkel):

 * cc: mikeschinkel@… (added)


Comment:

 Would this work?

 {{{
 function get_post_thumbnail_src( $post_id, $size = 'thumbnail', $icon =
 false) {
         if (!has_post_thumbnail( $post_id )) {
                 $src = false;
         } else {
                 $size = apply_filters( 'post_thumbnail_size', $size,
 $post_id, $icon );
                 $post_thumbnail_id = get_post_thumbnail_id( $post_id );
                 list($src) =
 wp_get_attachment_image_src($post_thumbnail_id, $size, $icon);
         }
         return apply_filters( 'post_thumbnail_src', $src, $post_id,
 $post_thumbnail_id, $size, $icon );
 }
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/11571#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list