Changeset 5818 for trunk/wp-includes/category.php
- Timestamp:
- 07/25/2007 03:04:46 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/category.php
r5642 r5818 19 19 if ( 'link' == $args['type'] ) 20 20 $taxonomy = 'link_category'; 21 return get_terms($taxonomy, $args); 21 $categories = get_terms($taxonomy, $args); 22 23 foreach ( $categories as $category ) 24 _make_cat_compat($category); 25 26 return $categories; 22 27 } 23 28 … … 25 30 // Handles category caching. 26 31 function &get_category(&$category, $output = OBJECT) { 27 return get_term($category, 'category', $output); 32 $category = get_term($category, 'category', $output); 33 34 _make_cat_compat($category); 35 36 return $category; 28 37 } 29 38 … … 65 74 66 75 function get_category_by_slug( $slug ) { 67 return get_term_by('slug', $slug, 'category'); 76 $category = get_term_by('slug', $slug, 'category'); 77 if ( $category ) 78 _make_cat_compat($category); 79 80 return $category; 68 81 } 69 82 … … 140 153 } 141 154 155 // 156 // Private helpers 157 // 158 159 function _make_cat_compat( &$category) { 160 if ( is_object($category) ) { 161 $category->cat_ID = &$category->term_id; 162 $category->category_count = &$category->count; 163 $category->category_description = &$category->description; 164 $category->cat_name = &$category->name; 165 $category->category_nicename = &$category->slug; 166 $category->category_parent = &$category->parent; 167 } else if ( is_array($category) && isset($category['term_id']) ) { 168 $category['cat_ID'] = &$category['term_id']; 169 $category['category_count'] = &$category['count']; 170 $category['category_description'] = &$category['description']; 171 $category['cat_name'] = &$category['name']; 172 $category['category_nicename'] = &$category['slug']; 173 $category['category_parent'] = &$category['parent']; 174 } 175 } 176 142 177 ?>
Note: See TracChangeset
for help on using the changeset viewer.