Changeset 19210
- Timestamp:
- 11/08/2011 02:08:25 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post-template.php
r19081 r19210 1153 1153 * @return string HTML content. 1154 1154 */ 1155 function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false) {1156 $id = intval( $id);1155 function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false ) { 1156 $id = intval( $id ); 1157 1157 $_post = & get_post( $id ); 1158 1158 1159 if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) )1160 return __( 'Missing Attachment');1159 if ( empty( $_post ) || ( 'attachment' != $_post->post_type ) || ! $url = wp_get_attachment_url( $_post->ID ) ) 1160 return __( 'Missing Attachment' ); 1161 1161 1162 1162 if ( $permalink ) 1163 $url = get_attachment_link( $_post->ID);1164 1165 $post_title = esc_attr( $_post->post_title);1166 1167 if ( $text ) {1168 $link_text = esc_attr( $text);1169 } elseif ( ( is_int($size) && $size != 0 ) or ( is_string($size) && $size != 'none' ) or $size != false ) {1170 $link_text = wp_get_attachment_image( $id, $size, $icon);1171 } else {1163 $url = get_attachment_link( $_post->ID ); 1164 1165 $post_title = esc_attr( $_post->post_title ); 1166 1167 if ( $text ) 1168 $link_text = esc_attr( $text ); 1169 elseif ( ( is_int( $size ) && $size != 0 ) || ( is_string( $size ) && $size != 'none' ) || $size != false ) 1170 $link_text = wp_get_attachment_image( $id, $size, $icon ); 1171 else 1172 1172 $link_text = ''; 1173 } 1174 1175 if( trim($link_text) == '' ) 1173 1174 if ( trim( $link_text ) == '' ) 1176 1175 $link_text = $_post->post_title; 1177 1176
Note: See TracChangeset
for help on using the changeset viewer.