Changeset 678 for trunk/wp-includes/links.php
- Timestamp:
- 01/01/2004 10:13:06 PM (23 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/links.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/links.php
r630 r678 515 515 * hide_if_empty (default true) - Supress listing empty link categories 516 516 */ 517 function get_links_list($order = 'name', $hide_if_empty = true) {517 function get_links_list($order = 'name', $hide_if_empty = 'obsolete') { 518 518 global $tablelinkcategories, $tablelinks, $wpdb; 519 519 … … 527 527 528 528 // if 'name' wasn't specified, assume 'id': 529 $cat_order = ('name' == $order)?'cat_name':'cat_id'; 530 531 if ($hide_if_empty) { 532 $extra_join = "LEFT JOIN $tablelinks ON link_category = cat_id"; 533 $group_by_having = 'GROUP BY cat_id HAVING count(link_id) > 0'; 534 } 529 $cat_order = ('name' == $order) ? 'cat_name' : 'cat_id'; 530 535 531 536 532 // Fetch the link category data as an array of hashes 537 $cats = $wpdb->get_results("SELECT cat_id, cat_name, show_images,533 $cats = $wpdb->get_results("SELECT DISTINCT link_category, cat_name, show_images, 538 534 show_description, show_rating, show_updated, sort_order, sort_desc, list_limit 539 FROM $tablelinkcategories $extra_join 540 $group_by_having 541 ORDER BY $cat_order $direction ", ARRAY_A);535 FROM `$tablelinks` LEFT JOIN `$tablelinkcategories` ON (link_category = cat_id) 536 WHERE link_visible = 'Y' 537 ORDER BY $cat_order $direction ", ARRAY_A); 542 538 543 539 // Display each category 544 540 if ($cats) { 545 // Start the unordered list546 echo "<ul>\n";547 548 541 foreach ($cats as $cat) { 549 542 // Handle each category. 550 551 543 // First, fix the sort_order info 552 544 $orderby = $cat['sort_order']; … … 554 546 555 547 // Display the category name 556 echo ' <li>' . stripslashes($cat['cat_name']) . "\n<ul>\n";548 echo ' <li>' . stripslashes($cat['cat_name']) . "\n\t<ul>\n"; 557 549 558 550 // Call get_links() with all the appropriate params 559 get_links($cat[' cat_id'],551 get_links($cat['link_category'], 560 552 '<li>',"</li>","\n", 561 553 bool_from_yn($cat['show_images']), … … 567 559 568 560 // Close the last category 569 echo "</ul>\n</li>\n"; 570 561 echo "\n\t</ul>\n</li>\n"; 571 562 } 572 // Close out our category list.573 echo "</ul>\n";574 563 } 575 564 }
Note: See TracChangeset
for help on using the changeset viewer.