| 104 | /** |
| 105 | * Retrieve Post Thumbnail URL |
| 106 | * |
| 107 | * @param int $post_id Optional. Post ID. |
| 108 | * @param string $size Optional. Image size. Defaults to 'post-thumbnail'. |
| 109 | * @return string|bool Image src, or false if the post does not have a thumbnail. |
| 110 | */ |
| 111 | function get_the_post_thumbnail_src( $post_id = null, $size = 'post-thumbnail' ) { |
| 112 | $post_thumbnail_id = get_post_thumbnail_id( $post_id ); |
| 113 | |
| 114 | if ( ! $post_thumbnail_id ) { |
| 115 | return false; |
| 116 | |
| 117 | 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 |
| 118 | if ( in_the_loop() ) |
| 119 | update_post_thumbnail_cache(); |
| 120 | $size = apply_filters( 'post_thumbnail_size', $size ); |
| 121 | list( $src ) = wp_get_attachment_image_src( $post_thumbnail_id, $size, false ); |
| 122 | do_action( 'end_fetch_post_thumbnail_html', $post_id, $post_thumbnail_id, $size ); |
| 123 | |
| 124 | return $src; |
| 125 | } |
| 126 | |