Cleaner, better, faster.
git-svn-id: https://develop.svn.wordpress.org/trunk@2975 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
5fc5164297
commit
7cd02175ff
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
Reference in New Issue