Rename get_post_link() to get_post_permalink() to avoid conflict with bbPress. Props scribu. fixes #12172

git-svn-id: http://svn.automattic.com/wordpress/trunk@13023 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-02-08 16:23:32 +00:00
parent 817f184ba0
commit 3ff118e774
1 changed files with 8 additions and 6 deletions

View File

@ -107,7 +107,7 @@ function get_permalink($id = 0, $leavename = false) {
elseif ( $post->post_type == 'attachment' )
return get_attachment_link($post->ID);
elseif ( in_array($post->post_type, get_post_types( array('_builtin' => false) ) ) )
return get_post_link($post);
return get_post_permalink($post);
$permalink = get_option('permalink_structure');
@ -171,7 +171,7 @@ function get_permalink($id = 0, $leavename = false) {
* @param bool $sample Optional, defaults to false. Is it a sample permalink.
* @return string
*/
function get_post_link( $id = 0, $leavename = false, $sample = false ) {
function get_post_permalink( $id = 0, $leavename = false, $sample = false ) {
global $wp_rewrite;
$post = &get_post($id);
@ -183,15 +183,17 @@ function get_post_link( $id = 0, $leavename = false, $sample = false ) {
$slug = $post->post_name;
if ( !empty($post_link) && ( ( isset($post->post_status) && 'draft' != $post->post_status && 'pending' != $post->post_status ) || $sample ) ) {
$draft_or_pending = 'draft' == $post->post_status || 'pending' == $post->post_status;
if ( !empty($post_link) && ( ( isset($post->post_status) && !$draft_or_pending ) || $sample ) ) {
$post_link = ( $leavename ) ? $post_link : str_replace("%$post->post_type%", $slug, $post_link);
$post_link = home_url( user_trailingslashit($post_link) );
} else {
$post_type = get_post_type_object($post->post_type);
if ( $post_type->query_var && ( isset($post->post_status) && 'draft' != $post->post_status && 'pending' != $post->post_status ) )
$post_link = "?$post_type->query_var=$slug";
if ( $post_type->query_var && ( isset($post->post_status) && !$draft_or_pending ) )
$post_link = add_query_arg($post_type->query_var, $slug, '');
else
$post_link = "?post_type=$post->post_type&p=$post->ID";
$post_link = add_query_arg(array('post_type' => $post->post_type, 'p' => $post->ID), '');
$post_link = home_url($post_link);
}