Make WordPress Core


Ignore:
Timestamp:
01/01/2004 10:13:06 PM (23 years ago)
Author:
saxmatt
Message:

Use modified get_links_list

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/links.php

    r630 r678  
    515515 *   hide_if_empty (default true)  - Supress listing empty link categories
    516516 */
    517 function get_links_list($order = 'name', $hide_if_empty = true) {
     517function get_links_list($order = 'name', $hide_if_empty = 'obsolete') {
    518518    global $tablelinkcategories, $tablelinks, $wpdb;
    519519
     
    527527
    528528    // 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
    535531
    536532    // 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,
    538534        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);
     535FROM `$tablelinks` LEFT JOIN `$tablelinkcategories` ON (link_category = cat_id)
     536WHERE link_visible =  'Y'
     537        ORDER BY $cat_order $direction ", ARRAY_A);
    542538
    543539    // Display each category
    544540    if ($cats) {
    545         // Start the unordered list
    546         echo "<ul>\n";
    547 
    548541        foreach ($cats as $cat) {
    549542            // Handle each category.
    550 
    551543            // First, fix the sort_order info
    552544            $orderby = $cat['sort_order'];
     
    554546
    555547            // 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";
    557549
    558550            // Call get_links() with all the appropriate params
    559             get_links($cat['cat_id'],
     551            get_links($cat['link_category'],
    560552                '<li>',"</li>","\n",
    561553                bool_from_yn($cat['show_images']),
     
    567559
    568560            // Close the last category
    569             echo "</ul>\n</li>\n";
    570 
     561            echo "\n\t</ul>\n</li>\n";
    571562        }
    572         // Close out our category list.
    573         echo "</ul>\n";
    574563    }
    575564}
Note: See TracChangeset for help on using the changeset viewer.