Changeset 13865
- Timestamp:
- 03/28/2010 05:23:49 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/post.php
r13769 r13865 1012 1012 function get_sample_permalink($id, $title = null, $name = null) { 1013 1013 $post = &get_post($id); 1014 if ( !$post->ID ) {1014 if ( !$post->ID ) 1015 1015 return array('', ''); 1016 } 1016 1017 $ptype = get_post_type_object($post->post_type); 1018 1017 1019 $original_status = $post->post_status; 1018 1020 $original_date = $post->post_date; … … 1030 1032 // If the user wants to set a new name -- override the current one 1031 1033 // Note: if empty name is supplied -- use the title instead, see #6072 1032 if ( !is_null($name) ) {1034 if ( !is_null($name) ) 1033 1035 $post->post_name = sanitize_title($name ? $name : $title, $post->ID); 1034 }1035 1036 1036 1037 $post->filter = 'sample'; … … 1038 1039 $permalink = get_permalink($post, true); 1039 1040 1041 if ( $ptype->query_var ) // Replace custom post_type Token with generic pagename token for ease of use. 1042 $permalink = str_replace('%' . $ptype->query_var . '%', '%pagename%', $permalink); 1043 1040 1044 // Handle page hierarchy 1041 if ( 'page' == $post->post_type) {1045 if ( $ptype->hierarchical ) { 1042 1046 $uri = get_page_uri($post->ID); 1043 1047 $uri = untrailingslashit($uri); … … 1045 1049 $uri = untrailingslashit($uri); 1046 1050 if ( !empty($uri) ) 1047 $uri .= '/';1051 $uri .= '/'; 1048 1052 $permalink = str_replace('%pagename%', "${uri}%pagename%", $permalink); 1049 1053 } … … 1075 1079 1076 1080 if ( 'publish' == $post->post_status ) { 1077 $view_post = 'post' == $post->post_type ? __('View Post') : __('View Page'); 1081 if ( 'post' == $post->post_type ) { 1082 $view_post = __('View Post'); 1083 } elseif ( 'page' == $post->post_type ) { 1084 $view_post = __('View Page'); 1085 } else { 1086 $ptype = get_post_type_object($post->post_type); 1087 $view_post = sprintf(__('View %s'), $ptype->singular_label); 1088 } 1078 1089 $title = __('Click to edit this part of the permalink'); 1079 1090 } else { -
trunk/wp-includes/link-template.php
r13831 r13865 109 109 return get_attachment_link($post->ID); 110 110 elseif ( in_array($post->post_type, get_post_types( array('_builtin' => false) ) ) ) 111 return get_post_permalink($post );111 return get_post_permalink($post, $leavename); 112 112 113 113 $permalink = get_option('permalink_structure');
Note: See TracChangeset
for help on using the changeset viewer.