Changeset 37915 for trunk/src/wp-includes/post-thumbnail-template.php
- Timestamp:
- 06/29/2016 05:28:00 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post-thumbnail-template.php
r37502 r37915 211 211 } 212 212 } 213 214 /** 215 * Returns the post thumbnail caption. 216 * 217 * @since 4.6.0 218 * 219 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`. 220 * @return string Post thumbnail caption. 221 */ 222 function get_the_post_thumbnail_caption( $post = null ) { 223 $post_thumbnail_id = get_post_thumbnail_id( $post ); 224 if ( ! $post_thumbnail_id ) { 225 return ''; 226 } 227 228 $caption = wp_get_attachment_caption( $post_thumbnail_id ); 229 230 if ( ! $caption ) { 231 $caption = ''; 232 } 233 234 return $caption; 235 } 236 237 /** 238 * Displays the post thumbnail caption. 239 * 240 * @since 4.6.0 241 * 242 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`. 243 */ 244 function the_post_thumbnail_caption( $post = null ) { 245 /** 246 * Filters the displayed post thumbnail caption. 247 * 248 * @since 4.6.0 249 * 250 * @param string $caption Caption for the given attachment. 251 */ 252 echo apply_filters( 'the_post_thumbnail_caption', get_the_post_thumbnail_caption( $post ) ); 253 }
Note: See TracChangeset
for help on using the changeset viewer.