Changeset 2396 for trunk/wp-includes/template-functions-category.php
- Timestamp:
- 03/01/2005 09:10:12 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/template-functions-category.php
r2387 r2396 4 4 global $post, $wpdb, $category_cache; 5 5 6 if (! $id) { 7 $id = $post->ID; 8 } 9 10 if ($category_cache[$id]) { 11 $categories = $category_cache[$id]; 6 if ( !$id ) 7 $id = $post->ID; 8 9 if ( $category_cache[$id] ) { 10 $categories = $category_cache[$id]; 12 11 } else { 13 $categories = $wpdb->get_results(" 14 SELECT category_id, cat_name, category_nicename, category_description, category_parent 15 FROM $wpdb->categories, $wpdb->post2cat 16 WHERE $wpdb->post2cat.category_id = cat_ID AND $wpdb->post2cat.post_id = '$id' 17 "); 18 19 } 20 21 if (!empty($categories)) 22 sort($categories); 23 else 24 $categories = array(); 25 26 return $categories; 12 $categories = $wpdb->get_results(" 13 SELECT category_id, cat_name, category_nicename, category_description, category_parent 14 FROM $wpdb->categories, $wpdb->post2cat 15 WHERE $wpdb->post2cat.category_id = cat_ID AND $wpdb->post2cat.post_id = '$id' 16 "); 17 } 18 19 if (!empty($categories)) 20 sort($categories); 21 else 22 $categories = array(); 23 24 return $categories; 27 25 } 28 26
Note: See TracChangeset
for help on using the changeset viewer.