WordPress.org

Make WordPress Core

Changeset 2364


Ignore:
Timestamp:
02/18/2005 04:42:49 PM (17 years ago)
Author:
michelvaldrighi
Message:

reverting the previous patch: it made it impossible to sort the list by category name

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/template-functions-category.php

    r2356 r2364  
    270270    }
    271271
    272     if ($hide_empty) {
    273         $categories = array();
    274         $extra_fields = 'cat_name, category_nicename, category_description,';
    275     } else {
    276         if (intval($categories)==0 && !$hide_empty){
    277             $sort_column = 'cat_'.$sort_column;
    278 
    279             $query  = "
    280                 SELECT cat_ID, cat_name, category_nicename, category_description, category_parent
    281                 FROM $wpdb->categories
    282                 WHERE cat_ID > 0 $exclusions
    283                 ORDER BY $sort_column $sort_order";
    284 
    285             $categories = $wpdb->get_results($query);
    286         }
    287         $extra_fields = '';
    288     }
    289 
     272    if (intval($categories)==0){
     273        $sort_column = 'cat_'.$sort_column;
     274
     275        $query  = "
     276            SELECT cat_ID, cat_name, category_nicename, category_description, category_parent
     277            FROM $wpdb->categories
     278            WHERE cat_ID > 0 $exclusions
     279            ORDER BY $sort_column $sort_order";
     280
     281        $categories = $wpdb->get_results($query);
     282    }
    290283    if (!count($category_posts)) {
    291284        $now = current_time('mysql', 1);
    292         $cat_counts = $wpdb->get_results("  SELECT cat_ID, $extra_fields
     285        $cat_counts = $wpdb->get_results("  SELECT cat_ID,
    293286        COUNT($wpdb->post2cat.post_id) AS cat_count
    294287        FROM $wpdb->categories
     
    302295                if (1 != intval($hide_empty) || $cat_count > 0) {
    303296                    $category_posts["$cat_count->cat_ID"] = $cat_count->cat_count;
    304                     if ($hide_empty) {
    305                         $categories[] = $cat_count;
    306                     }
    307297                }
    308298            }
Note: See TracChangeset for help on using the changeset viewer.