Ticket #2515: move_front_page.diff
| File move_front_page.diff, 1.6 KB (added by , 20 years ago) |
|---|
-
wp-includes/template-functions-links.php
26 26 } 27 27 28 28 29 function get_permalink($id = 0 ) {29 function get_permalink($id = 0, $move_front_page = true) { 30 30 $rewritecode = array( 31 31 '%year%', 32 32 '%monthnum%', … … 43 43 44 44 $post = &get_post($id); 45 45 if ( $post->post_type == 'page' ) 46 return get_page_link($post->ID );46 return get_page_link($post->ID, $move_front_page); 47 47 elseif ($post->post_type == 'attachment') 48 48 return get_attachment_link($post->ID); 49 49 … … 89 89 return get_permalink($post_id); 90 90 } 91 91 92 function get_page_link($id = false ) {92 function get_page_link($id = false, $move_front_page = true) { 93 93 global $post, $wp_rewrite; 94 94 95 95 if ( !$id ) … … 105 105 $link = get_settings('home') . "/?page_id=$id"; 106 106 } 107 107 108 if ( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') )108 if ( $move_front_page && 'page' == get_option('show_on_front') && $id == get_option('page_on_front') ) 109 109 $link = get_settings('home'); 110 110 111 111 return apply_filters('page_link', $link, $id); … … 123 123 $object = get_post($id); 124 124 if ( $wp_rewrite->using_permalinks() && ($object->post_parent > 0) ) { 125 125 $parent = get_post($object->post_parent); 126 $parentlink = get_permalink($object->post_parent );126 $parentlink = get_permalink($object->post_parent, false); 127 127 if (! strstr($parentlink, '?') ) 128 128 $link = trim($parentlink, '/') . '/' . $object->post_name . '/'; 129 129 }