Make WordPress Core


Ignore:
Timestamp:
05/23/2007 06:59:12 PM (17 years ago)
Author:
ryan
Message:

Convert category queries and list cats to taxonomy. see #4189

File:
1 edited

Legend:

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

    r5444 r5530  
    558558class Walker_Category extends Walker {
    559559    var $tree_type = 'category';
    560     var $db_fields = array ('parent' => 'category_parent', 'id' => 'cat_ID'); //TODO: decouple this
     560    var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this
    561561
    562562    function start_lvl($output, $depth, $args) {
     
    581581        extract($args);
    582582
    583         $cat_name = attribute_escape( $category->cat_name);
     583        $cat_name = attribute_escape( $category->name);
    584584        $cat_name = apply_filters( 'list_cats', $cat_name, $category );
    585         $link = '<a href="' . get_category_link( $category->cat_ID ) . '" ';
    586         if ( $use_desc_for_title == 0 || empty($category->category_description) )
     585        $link = '<a href="' . get_category_link( $category->term_id ) . '" ';
     586        if ( $use_desc_for_title == 0 || empty($category->description) )
    587587            $link .= 'title="' . sprintf(__( 'View all posts filed under %s' ), $cat_name) . '"';
    588588        else
    589             $link .= 'title="' . attribute_escape( apply_filters( 'category_description', $category->category_description, $category )) . '"';
     589            $link .= 'title="' . attribute_escape( apply_filters( 'category_description', $category->description, $category )) . '"';
    590590        $link .= '>';
    591591        $link .= $cat_name . '</a>';
     
    597597                $link .= '(';
    598598
    599             $link .= '<a href="' . get_category_rss_link( 0, $category->cat_ID, $category->category_nicename ) . '"';
     599            $link .= '<a href="' . get_category_rss_link( 0, $category->term_id, $category->slug ) . '"';
    600600
    601601            if ( empty($feed) )
     
    620620
    621621        if ( isset($show_count) && $show_count )
    622             $link .= ' (' . intval($category->category_count) . ')';
     622            $link .= ' (' . intval($category->count) . ')';
    623623
    624624        if ( isset($show_date) && $show_date ) {
     
    631631        if ( 'list' == $args['style'] ) {
    632632            $output .= "\t<li";
    633             if ( $current_category && ($category->cat_ID == $current_category) )
     633            if ( $current_category && ($category->term_id == $current_category) )
    634634                $output .=  ' class="current-cat"';
    635             elseif ( $_current_category && ($category->cat_ID == $_current_category->category_parent) )
     635            elseif ( $_current_category && ($category->term_id == $_current_category->parent) )
    636636                $output .=  ' class="current-cat-parent"';
    637637            $output .= ">$link\n";
     
    655655class Walker_CategoryDropdown extends Walker {
    656656    var $tree_type = 'category';
    657     var $db_fields = array ('parent' => 'category_parent', 'id' => 'cat_ID'); //TODO: decouple this
     657    var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this
    658658
    659659    function start_el($output, $category, $depth, $args) {
    660660        $pad = str_repeat('&nbsp;', $depth * 3);
    661661
    662         $cat_name = apply_filters('list_cats', $category->cat_name, $category);
    663         $output .= "\t<option value=\"".$category->cat_ID."\"";
    664         if ( $category->cat_ID == $args['selected'] )
     662        $cat_name = apply_filters('list_cats', $category->name, $category);
     663        $output .= "\t<option value=\"".$category->term_id."\"";
     664        if ( $category->term_id == $args['selected'] )
    665665            $output .= ' selected="selected"';
    666666        $output .= '>';
    667667        $output .= $pad.$cat_name;
    668668        if ( $args['show_count'] )
    669             $output .= '&nbsp;&nbsp;('. $category->category_count .')';
     669            $output .= '&nbsp;&nbsp;('. $category->count .')';
    670670        if ( $args['show_last_update'] ) {
    671671            $format = 'Y-m-d';
Note: See TracChangeset for help on using the changeset viewer.