diff --git a/wp-blog-header.php b/wp-blog-header.php index a79ce2ad47..3855ac0245 100644 --- a/wp-blog-header.php +++ b/wp-blog-header.php @@ -151,6 +151,9 @@ if ((empty($cat)) || ($cat == 'all') || ($cat == '0')) { $cat = ''.urldecode($cat).''; $cat = addslashes_gpc($cat); if (stristr($cat,'-')) { + // Note: if we have a negative, we ignore all the positives. It must + // always mean 'everything /except/ this one'. We should be able to do + // multiple negatives but we don't :-( $eq = '!='; $andor = 'AND'; $cat = explode('-',$cat); @@ -168,6 +171,9 @@ if ((empty($cat)) || ($cat == 'all') || ($cat == '0')) { $whichcat .= get_category_children($cat_array[$i], ' '.$andor.' category_id '.$eq.' '); } $whichcat .= ')'; + if ($eq == '!=') { + $cat = '-'.$cat; //put back the knowledge that we are excluding a category. + } } // Category stuff for nice URIs @@ -374,6 +380,6 @@ if ($posts) { if ($s && empty($paged)) { // If they were doing a search and got one result header('Location: ' . get_permalink($posts[0]->ID)); } -} -} + } +} // end if posts. ?> \ No newline at end of file diff --git a/wp-includes/template-functions-general.php b/wp-includes/template-functions-general.php index 131e511698..eee5c29dc0 100644 --- a/wp-includes/template-functions-general.php +++ b/wp-includes/template-functions-general.php @@ -65,7 +65,9 @@ function wp_title($sep = '»', $display = true) { // If there's a category if(!empty($cat)) { - $title = stripslashes(get_the_category_by_ID($cat)); + if (!stristr($cat,'-')) { // category excluded + $title = stripslashes(get_the_category_by_ID($cat)); + } } if (!empty($category_name)) { $title = stripslashes($wpdb->get_var("SELECT cat_name FROM $tablecategories WHERE category_nicename = '$category_name'"));