Changeset 12019
- Timestamp:
- 10/10/2009 08:31:21 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post-template.php
r12013 r12019 895 895 896 896 // 897 // Post images 898 // 899 900 function has_post_image( $post_id = NULL ) { 901 global $id; 902 $post_id = ( NULL === $post_id ) ? $id : $post_id; 903 return !! get_post_image_id( $post_id ); 904 } 905 906 function get_post_image_id( $post_id = NULL ) { 907 global $id; 908 $post_id = ( NULL === $post_id ) ? $id : $post_id; 909 return get_post_meta( $post_id, '_thumbnail_id', true ); 910 } 911 912 function the_post_image( $size = 'thumbnail' ) { 913 echo get_the_post_image( $size ); 914 } 915 916 function get_the_post_image( $size = 'thumbnail', $post_id = NULL ) { 917 global $id; 918 $post_id = ( NULL === $post_id ) ? $id : $post_id; 919 $post_image_id = get_post_image_id( $post_id ); 920 $size = apply_filters( 'post_image_size', $size ); 921 if ( $post_image_id ) { 922 do_action( 'begin_fetch_post_image_html', $post_id, $post_image_id, $size ); // for "Just In Time" filtering of all of wp_get_attachment_image()'s filters 923 $html = wp_get_attachment_image( $post_image_id, $size ); 924 do_action( 'end_fetch_post_image_html', $post_id, $post_image_id, $size ); 925 } else { 926 $html = ''; 927 } 928 return apply_filters( 'post_image_html', $html, $post_id, $post_image_id ); 929 } 930 931 // 897 932 // Attachments 898 933 //
Note: See TracChangeset
for help on using the changeset viewer.