Changeset 7064
- Timestamp:
- 02/27/2008 06:25:25 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/category-template.php
r7030 r7064 168 168 } 169 169 170 /* 171 * in_category() - Checks whether the current post is within a particular category 172 * 173 * This function checks to see if the post is within the supplied category. The categoy 174 * can be specified by number or name and will be checked as a name first to allow for categories with numeric names. 175 * Note: Prior to v2.5 of WordPress category names where not supported. 176 * 177 * @since 1.2.0 178 * 179 * @param int|string $category 180 * @return bool true if the post is in the supplied category 181 */ 170 182 function in_category( $category ) { // Check if the current post is in the given category 171 183 global $post; 172 184 173 if ( !is_numeric($category) ) {174 $category = get_cat_ID($category);175 }185 $cat_ID = get_cat_ID($category); 186 if (0 != $cat_ID) 187 $category = $cat_ID; 176 188 177 189 $categories = get_object_term_cache($post->ID, 'category');
Note: See TracChangeset
for help on using the changeset viewer.