Cleaner, better, faster.
git-svn-id: http://svn.automattic.com/wordpress/trunk@2975 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5521083d41
commit
e0e5a1659c
|
@ -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
|
||||
global $post, $category_cache;
|
||||
$cats = '';
|
||||
foreach ( $category_cache[$post->ID] as $cat ) {
|
||||
$cats[] = $cat->cat_ID;
|
||||
}
|
||||
global $category_cache;
|
||||
|
||||
if ( in_array($category, $cats) )
|
||||
if ( isset( $category_cache[$post->ID][$category] ) )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in New Issue