Changeset 727
- Timestamp:
- 01/06/2004 12:44:46 PM (22 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
wp-blog-header.php (modified) (2 diffs)
-
wp-includes/template-functions.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-blog-header.php
r726 r727 168 168 if ('' != $category_name) { 169 169 $category_name = preg_replace('|[^a-z0-9-/]|', '', $category_name); 170 $tables = ", $tablepost2cat, $tablecategories"; 170 171 $join = " LEFT JOIN $tablepost2cat ON ($tableposts.ID = $tablepost2cat.post_id) LEFT JOIN $tablecategories ON ($tablepost2cat.category_id = $tablecategories.cat_ID) "; 171 172 $whichcat = " AND (category_nicename = '$category_name') "; … … 320 321 $posts = $wpdb->get_results($request); 321 322 323 324 // Get the categories for all the posts 325 foreach ($posts as $post) { 326 $post_id_list[] = $post->ID; 327 } 328 $post_id_list = implode(',', $post_id_list); 329 330 $dogs = $wpdb->get_results("SELECT DISTINCT 331 ID, category_id, cat_name, category_nicename, category_description 332 FROM $tablecategories, $tablepost2cat, $tableposts 333 WHERE category_id = cat_ID AND post_id = ID AND post_id IN ($post_id_list)"); 334 335 foreach ($dogs as $catt) { 336 $category_cache[$catt->ID][] = $catt; 337 } 338 339 // Do the same for comment numbers 340 341 322 342 if (1 == count($posts)) { 323 343 if ($p || $name) { -
trunk/wp-includes/template-functions.php
r725 r727 1333 1333 1334 1334 function get_the_category() { 1335 global $post, $tablecategories, $tablepost2cat, $wpdb; 1336 $categories = $wpdb->get_results(" 1337 SELECT category_id, cat_name, category_nicename, category_description 1338 FROM $tablecategories, $tablepost2cat 1339 WHERE $tablepost2cat.category_id = cat_ID AND $tablepost2cat.post_id = $post->ID 1340 "); 1341 1342 return $categories; 1335 global $post, $tablecategories, $tablepost2cat, $wpdb, $category_cache; 1336 if ($category_cache[$post->ID]) { 1337 return $category_cache[$post->ID]; 1338 } else { 1339 $categories = $wpdb->get_results(" 1340 SELECT category_id, cat_name, category_nicename, category_description 1341 FROM $tablecategories, $tablepost2cat 1342 WHERE $tablepost2cat.category_id = cat_ID AND $tablepost2cat.post_id = $post->ID 1343 "); 1344 1345 return $categories; 1346 } 1343 1347 } 1344 1348
Note: See TracChangeset
for help on using the changeset viewer.