Make WordPress Core


Ignore:
Timestamp:
10/19/2010 10:10:11 AM (14 years ago)
Author:
dd32
Message:

Fix current-cat & current-cat-parent classes for Category listings for non-category taxonomies. General cleanup of wp_list_categories() sanity checking. Props TheDeadMedic for the initial taxonomy patch. Fixes #15143

File:
1 edited

Legend:

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

    r15825 r15847  
    15571557        $link .= $cat_name . '</a>';
    15581558
    1559         if ( (! empty($feed_image)) || (! empty($feed)) ) {
     1559        if ( !empty($feed_image) || !empty($feed) ) {
    15601560            $link .= ' ';
    15611561
     
    15651565            $link .= '<a href="' . get_term_feed_link( $category->term_id, $category->taxonomy, $feed_type ) . '"';
    15661566
    1567             if ( empty($feed) )
     1567            if ( empty($feed) ) {
    15681568                $alt = ' alt="' . sprintf(__( 'Feed for all posts filed under %s' ), $cat_name ) . '"';
    1569             else {
     1569            } else {
    15701570                $title = ' title="' . $feed . '"';
    15711571                $alt = ' alt="' . $feed . '"';
     
    15801580            else
    15811581                $link .= "<img src='$feed_image'$alt$title" . ' />';
     1582
    15821583            $link .= '</a>';
     1584
    15831585            if ( empty($feed_image) )
    15841586                $link .= ')';
    15851587        }
    15861588
    1587         if ( isset($show_count) && $show_count )
     1589        if ( !empty($show_count) )
    15881590            $link .= ' (' . intval($category->count) . ')';
    15891591
    1590         if ( isset($show_date) && $show_date ) {
     1592        if ( !empty($show_date) )
    15911593            $link .= ' ' . gmdate('Y-m-d', $category->last_update_timestamp);
    1592         }
    1593 
    1594         if ( isset($current_category) && $current_category )
    1595             $_current_category = get_category( $current_category );
    15961594
    15971595        if ( 'list' == $args['style'] ) {
    15981596            $output .= "\t<li";
    1599             $class = 'cat-item cat-item-'.$category->term_id;
    1600             if ( isset($current_category) && $current_category && ($category->term_id == $current_category) )
    1601                 $class .=  ' current-cat';
    1602             elseif ( isset($_current_category) && $_current_category && ($category->term_id == $_current_category->parent) )
    1603                 $class .=  ' current-cat-parent';
    1604             $output .=  ' class="'.$class.'"';
     1597            $class = 'cat-item cat-item-' . $category->term_id;
     1598            if ( !empty($current_category) ) {
     1599                $_current_category = get_term( $current_category, $category->taxonomy );
     1600                if ( $category->term_id == $current_category )
     1601                    $class .=  ' current-cat';
     1602                elseif ( $category->term_id == $_current_category->parent )
     1603                    $class .=  ' current-cat-parent';
     1604            }
     1605            $output .=  ' class="' . $class . '"';
    16051606            $output .= ">$link\n";
    16061607        } else {
Note: See TracChangeset for help on using the changeset viewer.