Fix category permalinks. Update cat_ID to term_id. fixes #4349 see #4189

git-svn-id: https://develop.svn.wordpress.org/trunk@5576 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2007-05-28 18:47:08 +00:00
parent c9b37847ce
commit 13dade0e8d
1 changed files with 6 additions and 6 deletions

View File

@ -73,8 +73,8 @@ function get_permalink($id = 0) {
$category = '';
if (strpos($permalink, '%category%') !== false) {
$cats = get_the_category($post->ID);
$category = $cats[0]->category_nicename;
if ( $parent=$cats[0]->category_parent )
$category = $cats[0]->slug;
if ( $parent=$cats[0]->parent )
$category = get_category_parents($parent, FALSE, '/', TRUE) . $category;
}
@ -359,9 +359,9 @@ function get_previous_post($in_same_cat = false, $excluded_categories = '') {
if ( $in_same_cat ) {
$join = " INNER JOIN $wpdb->post2cat ON $wpdb->posts.ID= $wpdb->post2cat.post_id ";
$cat_array = get_the_category($post->ID);
$join .= ' AND (category_id = ' . intval($cat_array[0]->cat_ID);
$join .= ' AND (category_id = ' . intval($cat_array[0]->term_id);
for ( $i = 1; $i < (count($cat_array)); $i++ ) {
$join .= ' OR category_id = ' . intval($cat_array[$i]->cat_ID);
$join .= ' OR category_id = ' . intval($cat_array[$i]->term_id);
}
$join .= ')';
}
@ -396,9 +396,9 @@ function get_next_post($in_same_cat = false, $excluded_categories = '') {
if ( $in_same_cat ) {
$join = " INNER JOIN $wpdb->post2cat ON $wpdb->posts.ID= $wpdb->post2cat.post_id ";
$cat_array = get_the_category($post->ID);
$join .= ' AND (category_id = ' . intval($cat_array[0]->cat_ID);
$join .= ' AND (category_id = ' . intval($cat_array[0]->term_id);
for ( $i = 1; $i < (count($cat_array)); $i++ ) {
$join .= ' OR category_id = ' . intval($cat_array[$i]->cat_ID);
$join .= ' OR category_id = ' . intval($cat_array[$i]->term_id);
}
$join .= ')';
}