View Single Post
Old 07-02-2007, 03:18 AM  
woman
Confirmed User
 
woman's Avatar
 
Join Date: Feb 2005
Location: Austria
Posts: 100
Try this:
PHP Code:
<?php
$exclude 
'';

// $orderby - Category table column (record) to sort on; for column
// options see note #2 above.
$orderby 'cat_name';

// $order - The sort order method. Use 'ASC'ending or 'DESC'ending.
$order 'ASC';

/* << user-configurable variables << */

if($exclude) { // set up the category exclude list for the query
    
$and '';
    
$wherecat 'AND (';
    
$exclude_cat preg_split('/[\s,]+/'$exclude);
    foreach (
$exclude_cat as $xcat) {
        
$wherecat .= $and ' cat_ID <> ' $xcat ' ';
        
$and 'AND';
    }
    
$wherecat .= ')';
}

global 
$wpdb// making sure the WP database object is around
/* the next line assigns the query results to $categories */
$categories $wpdb->get_results("SELECT * FROM $wpdb->categories WHERE category_count > 0 $wherecat ORDER BY $orderby $sort"); // $wp_object_cache->cache['category'];
?>
<?php 
/* >> category list loop >> the important part! */ ?>
<?php 
while(list(,$category) = each($categories)) : // start loop ?>
        <p>
        <h3 id="cat-<?php echo $category->cat_ID?>"><a href="<?php echo get_category_link($category->cat_ID); // returns category url ?>" title="<?php echo $category->cat_name?>"><?php echo $category->cat_name?></a></h3>
        <?php echo $category->category_description?> (<?php echo $category->category_count?> posts)
        </p>
<?php endwhile; // end loop ?>
<?php 
/* << category list loop << */ ?>
Greetings, woman
__________________
Sexgirls! makes money with VideoBox
woman is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote