Cleaner, better, faster.

git-svn-id: https://develop.svn.wordpress.org/trunk@2975 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Matt Mullenweg 2005-10-29 22:24:27 +00:00
parent 5fc5164297
commit 7cd02175ff
1 changed files with 3 additions and 6 deletions

View File

@ -415,15 +415,12 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde
} }
function in_category($category) { // Check if the current post is in the given category function in_category($category) { // Check if the current post is in the given category
global $post, $category_cache; global $category_cache;
$cats = '';
foreach ( $category_cache[$post->ID] as $cat ) {
$cats[] = $cat->cat_ID;
}
if ( in_array($category, $cats) ) if ( isset( $category_cache[$post->ID][$category] ) )
return true; return true;
else else
return false; return false;
} }
?> ?>