Ticket #2515: 2515.diff
File 2515.diff, 1.6 KB (added by , 18 years ago) |
---|
-
wp-includes/link-template.php
89 89 return get_permalink($post_id); 90 90 } 91 91 92 // Respects page_on_front. Use this one. 92 93 function get_page_link($id = false) { 94 global $post; 95 96 if ( !$id ) 97 $id = $post->ID; 98 99 if ( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') ) 100 $link = get_option('home'); 101 else 102 $link = _get_page_link( $id ); 103 104 return apply_filters('page_link', $link, $id); 105 } 106 107 // Ignores page_on_front. Internal use only. 108 function _get_page_link( $id = false ) { 93 109 global $post, $wp_rewrite; 94 110 95 111 if ( !$id ) … … 105 121 $link = get_option('home') . "/?page_id=$id"; 106 122 } 107 123 108 if ( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') ) 109 $link = get_option('home'); 110 111 return apply_filters('page_link', $link, $id); 124 return apply_filters( '_get_page_link', $link, $id ); 112 125 } 113 126 114 127 function get_attachment_link($id = false) { … … 123 136 $object = get_post($id); 124 137 if ( $wp_rewrite->using_permalinks() && ($object->post_parent > 0) ) { 125 138 $parent = get_post($object->post_parent); 126 $parentlink = get_permalink($object->post_parent); 139 if ( 'page' == $parent->post_type ) 140 $parentlink = _get_page_link( $object->post_parent ); // Ignores page_on_front 141 else 142 $parentlink = get_permalink( $object->post_parent ); 127 143 if (! strstr($parentlink, '?') ) 128 144 $link = trim($parentlink, '/') . '/' . $object->post_name . '/'; 129 145 }