Changeset 13774 for trunk/wp-includes/link-template.php
- Timestamp:
- 03/20/2010 02:23:52 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/link-template.php
r13733 r13774 188 188 $draft_or_pending = 'draft' == $post->post_status || 'pending' == $post->post_status; 189 189 190 $post_type = get_post_type_object($post->post_type); 191 190 192 if ( !empty($post_link) && ( ( isset($post->post_status) && !$draft_or_pending ) || $sample ) ) { 191 $post_link = ( $leavename ) ? $post_link : str_replace("%$post->post_type%", $slug, $post_link); 193 if ( ! $leavename ) { 194 if ( $post_type->hierarchical ) 195 $slug = get_page_uri($id); 196 $post_link = str_replace("%$post->post_type%", $slug, $post_link); 197 } 192 198 $post_link = home_url( user_trailingslashit($post_link) ); 193 199 } else { 194 $post_type = get_post_type_object($post->post_type);195 200 if ( $post_type->query_var && ( isset($post->post_status) && !$draft_or_pending ) ) 196 201 $post_link = add_query_arg($post_type->query_var, $slug, ''); … … 296 301 $link = false; 297 302 298 if ( ! $id) {303 if ( ! $id) 299 304 $id = (int) $post->ID; 300 }301 305 302 306 $object = get_post($id); … … 307 311 else 308 312 $parentlink = get_permalink( $object->post_parent ); 313 309 314 if ( is_numeric($object->post_name) || false !== strpos(get_option('permalink_structure'), '%category%') ) 310 315 $name = 'attachment/' . $object->post_name; // <permalink>/<int>/ is paged so we use the explicit attachment marker 311 316 else 312 317 $name = $object->post_name; 313 if (strpos($parentlink, '?') === false) 318 319 if ( strpos($parentlink, '?') === false ) 314 320 $link = user_trailingslashit( trailingslashit($parentlink) . $name ); 315 321 } 316 322 317 if ( ! $link ) {323 if ( ! $link ) 318 324 $link = trailingslashit(get_bloginfo('url')) . "?attachment_id=$id"; 319 }320 325 321 326 return apply_filters('attachment_link', $link, $id);
Note: See TracChangeset
for help on using the changeset viewer.